fun main(args: Array<String>) {
    val (n, x0) = readLine()!!.split(" ").map(String::toInt)
    val x = (readLine()!!.split(" ").map(String::toInt) + listOf(x0)).sorted()

    val delta = (0 until x.size-1).mapIndexed{i, n ->
        x[i+1] - x[i]
    }
    print(delta.reduce{a, b -> gcd(a,b)})
}

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