fun main(args: Array<String>) {
    val (N,X) = readLine()!!.split(" ").map{it.toInt()}
    val xs = readLine()!!.split(" ").map{it.toInt()} + X
    val min = xs.min()!!
    val ys = xs.map { it-min }.sorted()
    var z=ys[1]
    for(i in 2..N){
        z=gcd(z,ys[i]-ys[i-1])
    }
    println(z)
}

tailrec fun gcd(a:Int, b:Int):Int = if(b==0) a else gcd(b,a%b)