object Main extends App {
	import scala.math._
	val Array(t1, t2) = scala.io.StdIn.readLine.split(" ")
	val n = t1.toInt
	val x = t2.toLong

	val a = scala.io.StdIn.readLine.split(" ").map(_.toLong).sorted

	if(n==1){
		println(abs(a(0) - x))
	}else{
		val s = new Array[Long](n)
		s(0) = a.map(z => abs(z - x)).min
		for(i<-1 until n){
			s(i) = a(i) - a(i-1)
		}

		if(n == 2){
			println(gcd(s(0), s(1)))
		}else{
			var elm = gcd(s(0), s(1))
			for(i<-2 until n){
				elm = gcd(elm, s(i))
			}
			println(elm)
		}
	}

	def gcd(x: Long, y: Long) : Long = {
		if(y == 0L) return x
		else gcd(y, x%y)
	}

}