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

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



i = 0

while True:

    if X - i not in (p):

        print((X-i))

        exit()

    if X + i not in (p):

        print((X+i))

        exit()

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

if N==0: print(X);exit()

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

count = 0

while True:

  if X - count not in p:

    print((X-count))

    exit()

  if X + count not in p:

    print((X+count))

    exit()

  count += 1
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
i = 0
while True:
    if X - i not in (p):
        print((X - i))
        exit()
    if X + i not in (p):
        print((X + i))
        exit()
    i += 1

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    exit()
p = list(map(int, input().split()))
count = 0
while True:
    if X - count not in p:
        print((X - count))
        exit()
    if X + count not in p:
        print((X + count))
        exit()
    count += 1

+if N == 0: +    print(X) +    exit() -i = 0 +count = 0 -    if X - i not in (p): -        print((X - i)) +    if X - count not in p: +        print((X - count)) -    if X + i not in (p): -        print((X + i)) +    if X + count not in p: +        print((X + count)) -    i += 1 +    count += 1