fun main(args: Array<String>) {
    abc109c()
}

fun abc109c() {
    val (n, x) = readLine()!!.split(" ").map { it.toInt() }
    val xList = readLine()!!.split(" ").map { it.toInt() }

    val distances = xList.map { Math.abs(it - x) }
        .filter { it != 0 }

    var gcd = distances[0]
    (distances.indices).forEach { gcd = gcd(gcd, distances[it]) }

    println(gcd)
}

private fun gcd(a: Int, b: Int): Int {
    var aTemp = a
    var bTemp = b
    var temp: Int
    while (aTemp % bTemp != 0) {
        temp = aTemp
        aTemp = bTemp % aTemp
        bTemp = temp
    }
    return bTemp
}
