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



if n == 0:

    print(x)

    exit()



arr = list(map(int, input().split())) # p1 ... pn



arr2 = []

arr3 = []



for i in range(-50, 110):

    if not i in arr:

        arr2.append(i)

        arr3.append(abs(x - i))



n2 = min([i for i, v in enumerate(arr3) if v == min(arr3)])

print((arr2[n2]))
X, N = list(map(int, input().split()))

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

 

ans = 0

for i in range(1, 102):

    if abs(X - i) < abs(X - ans) and i not in arr:

        ans = i

print(ans)
x, n = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
arr = list(map(int, input().split()))  # p1 ... pn
arr2 = []
arr3 = []
for i in range(-50, 110):
    if not i in arr:
        arr2.append(i)
        arr3.append(abs(x - i))
n2 = min([i for i, v in enumerate(arr3) if v == min(arr3)])
print((arr2[n2]))

X, N = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 0
for i in range(1, 102):
    if abs(X - i) < abs(X - ans) and i not in arr:
        ans = i
print(ans)

-x, n = list(map(int, input().split())) -if n == 0: -    print(x) -    exit() -arr = list(map(int, input().split()))  # p1 ... pn -arr2 = [] -arr3 = [] -for i in range(-50, 110): -    if not i in arr: -        arr2.append(i) -        arr3.append(abs(x - i)) -n2 = min([i for i, v in enumerate(arr3) if v == min(arr3)]) -print((arr2[n2])) +X, N = list(map(int, input().split())) +arr = list(map(int, input().split())) +ans = 0 +for i in range(1, 102): +    if abs(X - i) < abs(X - ans) and i not in arr: +        ans = i +print(ans)