(* O(n) *)
let n, x0 = Scanf.scanf " %d %d" @@ fun a b -> a, b
let xs = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let f g x = gcd g @@ abs @@ x0 - x
let _ = Array.fold_left f 0 xs |> Printf.printf "%d\n"