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

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

p.sort()

li = []

ans = []

Min_sa = 9999999999

for i in range(-200,201):

    if i not in p:

        li.append(i)

for i in li:

     Min_sa = min(Min_sa,abs(x-i))

for i in li:

    if abs(x-i) == Min_sa:

        ans.append(i)

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

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

ans = 9999999999

lists = []

if n == 0:

    print(x)

    exit()

for i in range(-1000, 1000):

    if not i in p:

        lists.append(i)

for i in lists:

    if ans > abs(x - i):

        ans = abs(x-i)

        m = i



print(m)

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
li = []
ans = []
Min_sa = 9999999999
for i in range(-200, 201):
    if i not in p:
        li.append(i)
for i in li:
    Min_sa = min(Min_sa, abs(x - i))
for i in li:
    if abs(x - i) == Min_sa:
        ans.append(i)
print((min(ans)))

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 9999999999
lists = []
if n == 0:
    print(x)
    exit()
for i in range(-1000, 1000):
    if not i in p:
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x - i)
        m = i
print(m)

-p.sort() -li = [] -ans = [] -Min_sa = 9999999999 -for i in range(-200, 201): -    if i not in p: -        li.append(i) -for i in li: -    Min_sa = min(Min_sa, abs(x - i)) -for i in li: -    if abs(x - i) == Min_sa: -        ans.append(i) -print((min(ans))) +ans = 9999999999 +lists = [] +if n == 0: +    print(x) +    exit() +for i in range(-1000, 1000): +    if not i in p: +        lists.append(i) +for i in lists: +    if ans > abs(x - i): +        ans = abs(x - i) +        m = i +print(m)