let rec gcd x y = if y = 0 then x else gcd y (x mod y);;

let (n, x) = Scanf.scanf "%d %d" (fun x y -> (x, y)) in
let xs = Array.make n 0 in
for i = 0 to n - 1 do
  xs.(i) <- Scanf.scanf (if i = 0 then "\n%d" else " %d") (fun x -> x)
done;
print_int (xs |> Array.to_list |> List.map ((-) x) |> List.map abs |> List.fold_left gcd 0);
print_newline ()
