import sys

import numpy as np

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

if N == 0:

    print(X)

    sys.exit()

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



forbid = [True]*102



for i in range(len(p)):

    if forbid[p[i]]:

        forbid[p[i]] = False

        

pp = []



for i in range(len(forbid)):

    if forbid[i]:

        pp.append(i-X)



# num = pp[len(pp)-1]        

# for i in range(len(pp)-1,0,-1):

#     if abs(num) >= abs(pp[i]):

#         num = pp[i]

        

print((pp[np.argmin(np.abs(pp))]+X))

import sys

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

if N == 0:

    print(X)

    sys.exit()

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



forbid = [True]*102



for i in range(len(p)):

    if forbid[p[i]]:

        forbid[p[i]] = False

        

pp = []



for i in range(len(forbid)):

    if forbid[i]:

        pp.append(i-X)



num = pp[len(pp)-1]        

for i in range(len(pp)-1,-1,-1):

    if abs(num) >= abs(pp[i]):

        num = pp[i]

        

print((num+X))

import sys
import numpy as np

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    sys.exit()
p = list(map(int, input().split()))
forbid = [True] * 102
for i in range(len(p)):
    if forbid[p[i]]:
        forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
    if forbid[i]:
        pp.append(i - X)
# num = pp[len(pp)-1]
# for i in range(len(pp)-1,0,-1):
#     if abs(num) >= abs(pp[i]):
#         num = pp[i]
print((pp[np.argmin(np.abs(pp))] + X))

import sys

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    sys.exit()
p = list(map(int, input().split()))
forbid = [True] * 102
for i in range(len(p)):
    if forbid[p[i]]:
        forbid[p[i]] = False
pp = []
for i in range(len(forbid)):
    if forbid[i]:
        pp.append(i - X)
num = pp[len(pp) - 1]
for i in range(len(pp) - 1, -1, -1):
    if abs(num) >= abs(pp[i]):
        num = pp[i]
print((num + X))

-import numpy as np -# num = pp[len(pp)-1] -# for i in range(len(pp)-1,0,-1): -#     if abs(num) >= abs(pp[i]): -#         num = pp[i] -print((pp[np.argmin(np.abs(pp))] + X)) +num = pp[len(pp) - 1] +for i in range(len(pp) - 1, -1, -1): +    if abs(num) >= abs(pp[i]): +        num = pp[i] +print((num + X))