import Data.List

main = do
  [x, n] <- map read . words <$> getLine
  if n == 0 then do
    print x
  else do
    p <- map read . words <$> getLine
    let ps = sortBy (cmp x) $ [1..100] \\ p
    print $ head ps

cmp x a b
  | abs (a-x) > abs (b-x) = GT
  | abs (a-x) < abs (b-x) = LT
  | a > b = GT
  | a < b = LT
  | otherwise = EQ
