from bisect import bisect_left

import sys

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

if N==0:

    print(X)

    sys.exit()

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

P=sorted(P)

x=bisect_left(P,X)

if x>=len(P):

    print(X)

    sys.exit()

if P[x]!=X:

    print(X)

    sys.exit()

A=X

B=X

while True:

    A-=1

    B+=1

    x1=bisect_left(P,A)

    x2=bisect_left(P,B)

    if x1<len(P) and P[x1]!=A:

        print(A)

        break

    if x2<len(P) and P[x2]!=B:

        print(B)

        break

    if x2==len(P):

        print(B)

        break

import sys

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

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

if not X in P:

    print(X)

    sys.exit()

A=X

B=X

while True:

    A-=1

    B+=1

    if not A in P:

        print(A)

        sys.exit()

    if not B in P:

        print(B)

        sys.exit()
from bisect import bisect_left
import sys

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    sys.exit()
P = list(map(int, input().split()))
P = sorted(P)
x = bisect_left(P, X)
if x >= len(P):
    print(X)
    sys.exit()
if P[x] != X:
    print(X)
    sys.exit()
A = X
B = X
while True:
    A -= 1
    B += 1
    x1 = bisect_left(P, A)
    x2 = bisect_left(P, B)
    if x1 < len(P) and P[x1] != A:
        print(A)
        break
    if x2 < len(P) and P[x2] != B:
        print(B)
        break
    if x2 == len(P):
        print(B)
        break

import sys

X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
if not X in P:
    print(X)
    sys.exit()
A = X
B = X
while True:
    A -= 1
    B += 1
    if not A in P:
        print(A)
        sys.exit()
    if not B in P:
        print(B)
        sys.exit()

-from bisect import bisect_left -if N == 0: -    print(X) -    sys.exit() -P = sorted(P) -x = bisect_left(P, X) -if x >= len(P): -    print(X) -    sys.exit() -if P[x] != X: +if not X in P: -    x1 = bisect_left(P, A) -    x2 = bisect_left(P, B) -    if x1 < len(P) and P[x1] != A: +    if not A in P: -        break -    if x2 < len(P) and P[x2] != B: +        sys.exit() +    if not B in P: -        break -    if x2 == len(P): -        print(B) -        break +        sys.exit()