"use strict"

const gcd = (m, n) => {
  let tmp

  // m が n より 小さかったら入れ替える
  if (m < n) {
    tmp = m
    m = n
    n = tmp
  }
  while ((tmp = m % n) != 0) {
    m = n
    n = tmp
  }
  return n
}
// gcd(12, 42)

function main(input) {
  input = input.split(/\n/).map(v => v.split(/\s/).map(v => ~~v))
  const X = input[0][1]
  const distance = input[1].sort((a, b) => a - b).map(v => {
    return v - X
  })
  const ans = distance.reduce((a, b) => {
    return gcd(a, b)
  })
  console.log(Math.abs(ans))
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))
