open Printf
open Scanf

let id x = x

let n, x = scanf "%d %d" (fun n x -> n, x)
let xs = Array.init n (fun i -> scanf " %d" id)

let rec gcd m n =
  if m < n then gcd n m
  else if n = 0 then m
  else gcd n (m mod n)

let lcm m n = m * n / gcd m n

let calc n = abs (n - x)

let () =
  let r = ref (calc xs.(0)) in
  for i = 1 to n - 1 do
    r := gcd !r (calc xs.(i))
  done;
  printf "%d\n" !r
