x,n,*p=list(map(int,open(0).read().split()))

p=set(p)

l=r=x

while 1:

  if l not in p: print(l); break

  l-=1

  if r not in p: print(r); break

  r+=1
x,n,*p=list(map(int,open(0).read().split()))

l=r=x

while 1:

  if l not in p: print(l); break

  l-=1

  if r not in p: print(r); break

  r+=1
x, n, *p = list(map(int, open(0).read().split()))
p = set(p)
l = r = x
while 1:
    if l not in p:
        print(l)
        break
    l -= 1
    if r not in p:
        print(r)
        break
    r += 1

x, n, *p = list(map(int, open(0).read().split()))
l = r = x
while 1:
    if l not in p:
        print(l)
        break
    l -= 1
    if r not in p:
        print(r)
        break
    r += 1

-p = set(p)