let () =
  let rec makelist n m = if n = m then [m] else n :: makelist (n+1) m in
  Scanf.scanf "%d %d\n" @@ fun x n ->
  let p = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let _ = Array.fast_sort compare p in
  let q = Array.to_list p in
  let lst = makelist 0 101 in
  let (_, slst) = List.partition (fun x -> List.mem x q) lst in
  let (ans, _) = List.fold_left
      (fun (ans, diff) y -> if abs (x-y) < diff then (y, abs (x-y))
        else if abs (x-y) = diff && y < ans then (y, abs (x-y))
        else (ans,diff)) (102, max_int) slst in
  Printf.printf "%d\n" ans