object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val x = sc.nextLong
    val a = new Array[Long](n)
    for (i <- 0 until n) {
      a(i) = sc.nextLong
    }

    val abss = a.map(v => (v - x).abs).sorted
    var divisor = abss.min
    for (i <- 1 until n) {
      if (abss(i) % divisor != 0) {
        divisor = Util.gcd(abss(i), divisor)
      }
    }
    println(divisor)
  }
}
