let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let () =
  Scanf.scanf "%d %d" @@ fun n x0 ->
  let d = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0))
    |> Array.map (fun x -> abs (x - x0))
  in
  Array.fold_left (fun u v -> gcd u v) d.(0) d
    |> Printf.printf "%d\n"