import random



X,N = input().split()

X,N = int(X),int(N)



P = input().split()

P = [int(c) for c in P]



if len(P) == 0:

    print(X)    

else:

    L = list(range(max(0,X-N),min(102,X+N)))



    if X+N <= 101:

        L.append(X+N)



    for i in range(N):

        if P[i] in L:

            L.remove(P[i])



    while len(L) > 2:

        rand = random.randint(1,len(L)-2)

        if L[rand] == X:

            break

        elif L[rand] > X:

            L = L[0:rand+1]

        else:

            L = L[rand:len(L)]



    if X in L:

        print(X)

    elif len(L) == 1:

        print((L[0]))

    else:

        if abs(L[0]-X) > abs(L[1]-X):

            print((L[1]))

        else:

            print((L[0]))
X,N = input().split()

X,N = int(X),int(N)



P = input().split()

P = [int(c) for c in P]



i = X

j = X



if len(P) == 0:

    print(X)    

elif X  not in P:

    print(X)

else:

    while i < 101:

        i += 1

        if i not in P:

            break

    while j > 0:

        j -= 1

        if j not in P:

            break

    

    if i - X >= X - j:

        print(j)

    else:

        print(i)
import random

X, N = input().split()
X, N = int(X), int(N)
P = input().split()
P = [int(c) for c in P]
if len(P) == 0:
    print(X)
else:
    L = list(range(max(0, X - N), min(102, X + N)))
    if X + N <= 101:
        L.append(X + N)
    for i in range(N):
        if P[i] in L:
            L.remove(P[i])
    while len(L) > 2:
        rand = random.randint(1, len(L) - 2)
        if L[rand] == X:
            break
        elif L[rand] > X:
            L = L[0 : rand + 1]
        else:
            L = L[rand : len(L)]
    if X in L:
        print(X)
    elif len(L) == 1:
        print((L[0]))
    else:
        if abs(L[0] - X) > abs(L[1] - X):
            print((L[1]))
        else:
            print((L[0]))

X, N = input().split()
X, N = int(X), int(N)
P = input().split()
P = [int(c) for c in P]
i = X
j = X
if len(P) == 0:
    print(X)
elif X not in P:
    print(X)
else:
    while i < 101:
        i += 1
        if i not in P:
            break
    while j > 0:
        j -= 1
        if j not in P:
            break
    if i - X >= X - j:
        print(j)
    else:
        print(i)

-import random - +i = X +j = X +elif X not in P: +    print(X) -    L = list(range(max(0, X - N), min(102, X + N))) -    if X + N <= 101: -        L.append(X + N) -    for i in range(N): -        if P[i] in L: -            L.remove(P[i]) -    while len(L) > 2: -        rand = random.randint(1, len(L) - 2) -        if L[rand] == X: +    while i < 101: +        i += 1 +        if i not in P: -        elif L[rand] > X: -            L = L[0 : rand + 1] -        else: -            L = L[rand : len(L)] -    if X in L: -        print(X) -    elif len(L) == 1: -        print((L[0])) +    while j > 0: +        j -= 1 +        if j not in P: +            break +    if i - X >= X - j: +        print(j) -        if abs(L[0] - X) > abs(L[1] - X): -            print((L[1])) -        else: -            print((L[0])) +        print(i)