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

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

a=0

for i in range(100):

    if x-i not in l:

        ans=x-i

        a=i+1

        break

for i in range(100):

    if x+i not in l:

        ansb=x+i

        ab=i+1

        break

if a>ab:

    print(ansb)

else:

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

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

flag=0

i=0

while flag==0:

    if x-i not in l:

        flag=1

        ansa=x-i

    i+=1

flag=0

i=0

while flag==0:

    if x+i not in l:

        flag=1

        ansb=x+i

    i+=1

if abs(ansa-x)<=abs(ansb-x):

    print(ansa)

else:

    print(ansb)
x, n = list(map(int, input().split()))
l = list(map(int, input().split()))
a = 0
for i in range(100):
    if x - i not in l:
        ans = x - i
        a = i + 1
        break
for i in range(100):
    if x + i not in l:
        ansb = x + i
        ab = i + 1
        break
if a > ab:
    print(ansb)
else:
    print(ans)

x, n = list(map(int, input().split()))
l = list(map(int, input().split()))
flag = 0
i = 0
while flag == 0:
    if x - i not in l:
        flag = 1
        ansa = x - i
    i += 1
flag = 0
i = 0
while flag == 0:
    if x + i not in l:
        flag = 1
        ansb = x + i
    i += 1
if abs(ansa - x) <= abs(ansb - x):
    print(ansa)
else:
    print(ansb)

-a = 0 -for i in range(100): +flag = 0 +i = 0 +while flag == 0: -        ans = x - i -        a = i + 1 -        break -for i in range(100): +        flag = 1 +        ansa = x - i +    i += 1 +flag = 0 +i = 0 +while flag == 0: +        flag = 1 -        ab = i + 1 -        break -if a > ab: +    i += 1 +if abs(ansa - x) <= abs(ansb - x): +    print(ansa) +else: -else: -    print(ans)