fun main(arr: Array<String>) {
    val (n,x) = readLine()!!.split(" ").map { it.toInt() }
    var a = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    a.add(x)
    a = a.distinct().sorted().toMutableList()
    a = (1..a.lastIndex).map { a[it] - a[it-1] }.toMutableList()
    println(a.reduce { acc, i -> getGCM(acc, i) })
}

fun getGCM(num1:Int, num2:Int):Int {
    if(num1 % num2 == 0) {
        return num2
    }
    return getGCM(num2, num1%num2)
}