fun main(args: Array<String>) {
    val (N, X) = listOfInt()
    val x = listOfInt()
    val d = x.map { Math.abs(X - it) }
    val ans = d.reduce { acc, value -> gcd(acc, value) }
    println(ans)
}
fun gcd(a: Int, b: Int): Int = if (b > 0) gcd(b, a % b) else a

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
