fun main(args: Array<String>) {
    val nx = readLine()!!.split(" ")
    val numN = nx[0].toInt()
    val numX = nx[1].toLong()
    val xList = readLine()!!.split(" ").map(String::toLong).toMutableList()
    xList.add(numX)
    val diffList = mutableListOf<Long>()
    xList.sort()


    for(i in 1 .. numN){
        diffList.add(xList[i] - xList[i - 1])
    }
    var result = 0L


    if(diffList.size == 1){
        result = diffList[0]
    }else{
        for(i in 0 until diffList.size - 1){
            result = if(i == 0){
                gcd(diffList[i + 1], diffList[i])
            }else{
                gcd(diffList[i + 1], result)
            }
        }
    }

    println(result);
}

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