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

let () = Scanf.scanf "%d %d\n" @@ fun n x ->
  let xs = Array.init n @@ fun _ ->
    Scanf.scanf "%d " @@ fun x -> x in
  Printf.printf "%d\n" @@ Array.fold_right (fun x' -> gcd @@ abs @@ x' - x) xs 0
