// C - Skip
// https://abc109.contest.atcoder.jp/tasks/abc109_c

import scala.io.StdIn.readLine

object Main extends App {

  val Array(n, x) = readLine.split(" ").map(_.toInt)
  val xs: List[Int] = readLine.split(" ").map(_.toInt).toList

  val insertedXs = (x :: xs).sorted
  val intervals = insertedXs.sliding(2).map(iss => iss(1) - iss(0)).toList

  def gcd(a: Int, b: Int): Int = {
    if (b == 0) a
    else gcd(b, a % b)
  }

  val d = intervals.reduceLeft(gcd(_, _))

  println(d)

}