nii=lambda:list(map(int,input().split()))

lnii=lambda:list(map(int,input().split()))



x,n=nii()

p=lnii()



dist=1000

ans=[]

aa=[]

for i in range(-10,110):

  if i not in p:

    ans.append(abs(x-i))

    aa.append(i)

min_inx=ans.index(min(ans))

print((aa[min_inx]))
nii=lambda:list(map(int,input().split()))

lnii=lambda:list(map(int,input().split()))



x,n=nii()

p=lnii()



dist=1000

ans=1000

for i in range(101,-1,-1):

  if i not in p:

    t_dist=abs(x-i)

    if t_dist<=dist:

      dist=t_dist

      ans=i

print(ans)
nii = lambda: list(map(int, input().split()))
lnii = lambda: list(map(int, input().split()))
x, n = nii()
p = lnii()
dist = 1000
ans = []
aa = []
for i in range(-10, 110):
    if i not in p:
        ans.append(abs(x - i))
        aa.append(i)
min_inx = ans.index(min(ans))
print((aa[min_inx]))

nii = lambda: list(map(int, input().split()))
lnii = lambda: list(map(int, input().split()))
x, n = nii()
p = lnii()
dist = 1000
ans = 1000
for i in range(101, -1, -1):
    if i not in p:
        t_dist = abs(x - i)
        if t_dist <= dist:
            dist = t_dist
            ans = i
print(ans)

-ans = [] -aa = [] -for i in range(-10, 110): +ans = 1000 +for i in range(101, -1, -1): -        ans.append(abs(x - i)) -        aa.append(i) -min_inx = ans.index(min(ans)) -print((aa[min_inx])) +        t_dist = abs(x - i) +        if t_dist <= dist: +            dist = t_dist +            ans = i +print(ans)