import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use {
        val n = it.nextInt()
        val x = it.nextInt()
        val xx = mutableListOf<Int>()

        for (i in 0 until n) {
            xx.add(Math.abs(it.nextInt() - x))
        }

        while (1 < xx.size) {
            if (xx[0] < xx[1]) {
                val tmp = xx[0]
                xx[0] = xx[1]
                xx[1] = tmp
            }

            val r = xx[0] % xx[1]
            xx[0] = xx[1]

            if (r == 0) {
                xx.removeAt(1)
            } else {
                xx[1] = r
            }
        }

        println(xx[0])
    }
}
