import java.util.*

fun gcd (a: Int, b: Int) : Int {
    if (b == 0) return a
    else return gcd(b, a % b)
}

fun main(args: Array<String>) {
    val cin = Scanner(System.`in`)
    val N: Int = cin.nextInt()
    val X: Int = cin.nextInt()
    var xs = ArrayList<Int>()
    for (i in 1..N) {
        xs.add(Math.abs(cin.nextInt() - X))
    }
    var ans = xs[0]
    for (i in 1..N-1) {
        ans = gcd(ans, xs[i])
    }
    println(ans)
}