fun main(args: Array<String>) {
    val mod = 1000000007
    val (N,X) = readIntList()
    val x = readLongList()

    var gcd = Math.abs(x[0]-X)

    for (y in x)
        gcd = gcd(gcd, Math.abs(y-X))

    println(gcd)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun gcd(a:Long, b:Long):Long {
    if (a%b == 0L) return b
    return gcd(b, a % b)
}