import numpy as np

X, N = list(map(int, input().split()))

if N == 0:

    print(X)

else:

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

    app = [x for x in range(X - int(N / 2) - 1, X + int(N / 2) + 1) if x not in l]

    print((app[np.argmin([abs(x - X) for x in app])]))
#cited from ppunchi

X, N = list(map(int, input().split()))

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

l = X - 1

r = X + 1

if not X in p:

    print(X)

    exit()

while True:

    if not l in p:

        print(l)

        break

    elif not r in p:

        print(r)

        break

    l -= 1

    r += 1

import numpy as np

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
else:
    l = list(map(int, input().split()))
    app = [x for x in range(X - int(N / 2) - 1, X + int(N / 2) + 1) if x not in l]
    print((app[np.argmin([abs(x - X) for x in app])]))

# cited from ppunchi
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
l = X - 1
r = X + 1
if not X in p:
    print(X)
    exit()
while True:
    if not l in p:
        print(l)
        break
    elif not r in p:
        print(r)
        break
    l -= 1
    r += 1

-import numpy as np - +# cited from ppunchi -if N == 0: +p = list(map(int, input().split())) +l = X - 1 +r = X + 1 +if not X in p: -else: -    l = list(map(int, input().split())) -    app = [x for x in range(X - int(N / 2) - 1, X + int(N / 2) + 1) if x not in l] -    print((app[np.argmin([abs(x - X) for x in app])])) +    exit() +while True: +    if not l in p: +        print(l) +        break +    elif not r in p: +        print(r) +        break +    l -= 1 +    r += 1