X,N,*p = list(map(int,open(0).read().split()))

dif = 100

ans = -1

for i in range(102):

    a = abs(X-i)

    if i in p:

        continue

    if  a < dif:

        dif = a

        ans = i

print(ans)
X,N= list(map(int,input().split()))

p = list(map(int,input().split()))

for i in range(100):

  if X-i not in p:

    print((X-i))

    exit()

  if X+i not in p:

    print((X+i))

    exit()
X, N, *p = list(map(int, open(0).read().split()))
dif = 100
ans = -1
for i in range(102):
    a = abs(X - i)
    if i in p:
        continue
    if a < dif:
        dif = a
        ans = i
print(ans)

X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(100):
    if X - i not in p:
        print((X - i))
        exit()
    if X + i not in p:
        print((X + i))
        exit()

-X, N, *p = list(map(int, open(0).read().split())) -dif = 100 -ans = -1 -for i in range(102): -    a = abs(X - i) -    if i in p: -        continue -    if a < dif: -        dif = a -        ans = i -print(ans) +X, N = list(map(int, input().split())) +p = list(map(int, input().split())) +for i in range(100): +    if X - i not in p: +        print((X - i)) +        exit() +    if X + i not in p: +        print((X + i)) +        exit()