let rec gcd aa bb =
  let a = abs aa
  and b = abs bb in
  if b = 0 then a else gcd b (a mod b);;
  
let solve x list =
  let org_adj_list = List.map (fun k -> k - x) list in
  let gcdes = List.rev_map2 gcd (List.rev org_adj_list) org_adj_list in
  List.fold_left min 10000000000 gcdes
          
let read_list_of_int () =
  let rec read_list_of_int_inner lst =
    try let ans = (Scanf.scanf "%d " (fun x->x)) in
        read_list_of_int_inner (ans::lst)
    with End_of_file ->
      List.rev lst
  in
  read_list_of_int_inner []

let () =
  try let n, x = (Scanf.scanf "%d %d\n" (fun a b -> (a, b))) in
      let list = read_list_of_int () in
      let ans = solve x list in
      Printf.printf "%d\n" ans
  with End_of_file -> ()
;;
