import sys

x,n = list(map(int,input().split()))

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

s = 100

min_i = -1



if x not in p:

    print(x)

    sys.exit()



for i in range(-1,102):

    if i not in p and abs(i-x) < s:

        s = abs(i-x)

        min_i = i



        

print(min_i)

x,n = list(map(int,input().split()))

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



i = 0

ans = -1



while True:

    temp1 = x - i

    temp2 = x + i

    if temp1 not in p:

        ans = temp1

        break

    if temp2 not in p:

        ans = temp2

        break

    i += 1

print(ans)
import sys

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
s = 100
min_i = -1
if x not in p:
    print(x)
    sys.exit()
for i in range(-1, 102):
    if i not in p and abs(i - x) < s:
        s = abs(i - x)
        min_i = i
print(min_i)

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
i = 0
ans = -1
while True:
    temp1 = x - i
    temp2 = x + i
    if temp1 not in p:
        ans = temp1
        break
    if temp2 not in p:
        ans = temp2
        break
    i += 1
print(ans)

-import sys - -s = 100 -min_i = -1 -if x not in p: -    print(x) -    sys.exit() -for i in range(-1, 102): -    if i not in p and abs(i - x) < s: -        s = abs(i - x) -        min_i = i -print(min_i) +i = 0 +ans = -1 +while True: +    temp1 = x - i +    temp2 = x + i +    if temp1 not in p: +        ans = temp1 +        break +    if temp2 not in p: +        ans = temp2 +        break +    i += 1 +print(ans)