x,n = input().split()

x=int(x)

n=int(n)

list=input().split()

for i in range(0, len(list)):

    list[i] = int(list[i])

diff = 200

for i in range(-1, 102):

    if i not in list and abs(i-x) < diff:

        diff = abs(i-x)

        ans = i

print(ans)
x,n = input().split()

x=int(x)

list=input().split()

diff = 200

for i in range(-1, 102):

    if str(i) not in list and abs(i-x) < diff:

        diff = abs(i-x)

        ans = i

print(ans)
x, n = input().split()
x = int(x)
n = int(n)
list = input().split()
for i in range(0, len(list)):
    list[i] = int(list[i])
diff = 200
for i in range(-1, 102):
    if i not in list and abs(i - x) < diff:
        diff = abs(i - x)
        ans = i
print(ans)

x, n = input().split()
x = int(x)
list = input().split()
diff = 200
for i in range(-1, 102):
    if str(i) not in list and abs(i - x) < diff:
        diff = abs(i - x)
        ans = i
print(ans)

-n = int(n) -for i in range(0, len(list)): -    list[i] = int(list[i]) -    if i not in list and abs(i - x) < diff: +    if str(i) not in list and abs(i - x) < diff: