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



if N == 0:

  print(X)

  exit();



p = [int(i) for i in input().split()]



if X not in p:

  print(X)

  exit();



if N == 1 and p[0] == X:

  print((X-1))

  exit();



for j in range(101):

  if X-j not in p:

    print((X-j))

    exit();

  if X+j not in p:

    print((X+j))

    exit();

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



if N == 0:

  print(X)

  exit();



p = [int(i) for i in input().split()]

  

q = set(range(102)) - set(p)  

  

r = sorted(q,key=lambda x:(abs(x-X),x))



print((r[0]))
X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    exit()
p = [int(i) for i in input().split()]
if X not in p:
    print(X)
    exit()
if N == 1 and p[0] == X:
    print((X - 1))
    exit()
for j in range(101):
    if X - j not in p:
        print((X - j))
        exit()
    if X + j not in p:
        print((X + j))
        exit()

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    exit()
p = [int(i) for i in input().split()]
q = set(range(102)) - set(p)
r = sorted(q, key=lambda x: (abs(x - X), x))
print((r[0]))

-if X not in p: -    print(X) -    exit() -if N == 1 and p[0] == X: -    print((X - 1)) -    exit() -for j in range(101): -    if X - j not in p: -        print((X - j)) -        exit() -    if X + j not in p: -        print((X + j)) -        exit() +q = set(range(102)) - set(p) +r = sorted(q, key=lambda x: (abs(x - X), x)) +print((r[0]))