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



if N==0:

  print(X)

  exit(0)

  

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



for i in range(101):

  for s in [-1,1]:

    a = X + i*s

    if a not in p:

      print(a)

      exit(0)

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



if N==0:

  print(X)

  exit(0)

  

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



for i in range(X+1):

  for s in [-1,1]:

    a = X + i*s

    if a not in p:

      print(a)

      exit(0)

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

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

-for i in range(101): +for i in range(X + 1):