import sys



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



X, N, *P = list(map(int, read().split()))



nums = list(range(-10, 110))



for p in P:

    nums.remove(p)



answer = min(nums, key=lambda x: (abs(x - X), x))

print(answer)
import sys



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



X, N, *P = list(map(int, read().split()))

se = frozenset(P)



def gen_nums(X):

  low, high = X-1, X

  while True:

    yield high

    yield low

    low, high = low-1, high+1



for x in gen_nums(X):

  if x not in se:

    break



print(x)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
nums = list(range(-10, 110))
for p in P:
    nums.remove(p)
answer = min(nums, key=lambda x: (abs(x - X), x))
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
se = frozenset(P)


def gen_nums(X):
    low, high = X - 1, X
    while True:
        yield high
        yield low
        low, high = low - 1, high + 1


for x in gen_nums(X):
    if x not in se:
        break
print(x)

-nums = list(range(-10, 110)) -for p in P: -    nums.remove(p) -answer = min(nums, key=lambda x: (abs(x - X), x)) -print(answer) +se = frozenset(P) + + +def gen_nums(X): +    low, high = X - 1, X +    while True: +        yield high +        yield low +        low, high = low - 1, high + 1 + + +for x in gen_nums(X): +    if x not in se: +        break +print(x)