import java.util.ArrayList;
fun main(args: Array<String>) {
    val (N, X) = readLine()!!.split(" ").map(String::toInt)
    val x = java.util.ArrayList(readLine()!!.split(" ").map(String::toInt))
    x.add(X)
    x.sort()
    var ans = x[1] - x[0]
    for (i in 2..N) {
        val d = x[i] - x[i-1]
        ans = if (ans > d) gcd(ans, d) else gcd(d, ans)
    }
    println(ans)
}

tailrec fun gcd(big: Int, small: Int): Int =
    if (small == 0) big else gcd(small, big % small)