
fun main(args: Array<String>) {
    val (N, X) = readLine()!!.split(" ").map { it.toLong() }
    val x = readLine()!!.split(" ").map { it.toLong() - X }

    if (x.size == 1) {
        val first = Math.abs(x.first())
        println(first)
        return
    }

    val GCD = x.reduce { acc, i -> gcd(acc, i)  }
    println(Math.abs(GCD))
}



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

