let () = Scanf.scanf "%d %d\n" @@ fun x n ->
  let forbidden = Array.make 110 false in
  let ans = ref 0 in
  for i=1 to n do
    Scanf.scanf " %d" @@ fun p -> forbidden.(p) <- true
  done;
  for i=1 to 101 do
    if forbidden.(i) = false && abs (x - i) < abs (x - !ans) then ans := i
  done;
  Printf.printf "%d\n" !ans