object Main extends App {
  def findGcd(prev: Int, xlist: List[Int]): Int = {
    def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a % b)
    if (xlist.tail.isEmpty) xlist.head - prev
    else gcd(xlist.head - prev, findGcd(xlist.head, xlist.tail))
  }

  val temp: Array[Int] = io.StdIn.readLine().split(" ").map(_.toInt)
  val list: List[Int] = io.StdIn.readLine().split(" ").map(_.toInt).toList
  val N = temp(0)
  val X = temp(1)
  val xList = (X :: list).sorted
  val D = findGcd(xList.head, xList.tail)
  println(D)
}
