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

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

for i in range(1000):

  tmp = [x-i, x+i]

  if tmp[0] not in p:

    print((tmp[0]))

    exit()

  elif tmp[1] not in p:

    print((tmp[1]))

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

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



for i in range(1000):

    if x-i not in p:

        print((x-i))

        exit()

    elif x+i not in p:

        print((x+i))

        exit()
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(1000):
    tmp = [x - i, x + i]
    if tmp[0] not in p:
        print((tmp[0]))
        exit()
    elif tmp[1] not in p:
        print((tmp[1]))
        exit()

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(1000):
    if x - i not in p:
        print((x - i))
        exit()
    elif x + i not in p:
        print((x + i))
        exit()

-    tmp = [x - i, x + i] -    if tmp[0] not in p: -        print((tmp[0])) +    if x - i not in p: +        print((x - i)) -    elif tmp[1] not in p: -        print((tmp[1])) +    elif x + i not in p: +        print((x + i))