fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
tailrec fun gcd(a: Int, b: Int): Int {
    return if (b == 0) a else gcd(b, a % b)
}
fun main(args: Array<String>) {
    val (n, x) = intList()
    val xList = intList()

    val sorted = (xList + x).sorted()
    var prev = -1
    sorted.forEachIndexed { i, v ->
        if (i > 0) {
            val distance = v - sorted[i - 1]
            if (prev > -1) {
                prev = gcd(prev, distance)
            } else {
                prev = distance
            }
        }
    }

    println(prev.toString())
}
