Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N.
Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.

-----Constraints-----
 - 1 \leq X \leq 100
 - 0 \leq N \leq 100
 - 1 \leq p_i \leq 100
 - p_1, \ldots, p_N are all distinct.
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
X N
p_1 ... p_N

-----Output-----
Print the answer.

-----Sample Input-----
6 5
4 7 10 6 5

-----Sample Output-----
8

Among the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.

Difficulty: introductory

Starter code:

Solutions:
x,n=map(int,input().split())
p=list(map(int,input().split()))
a=101
m=101-x
for i in range(102):
  i=100-i
  if i in p:
    continue
  M=abs(i-x)
  if M<=m:
    m=M
    a=i
print(a)

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

if not X in p:
    print(X)
    return

left = -200
for a in range(X-1, -1, -1):
    if not a in p:
        left = a 
        break

right = 200
for a in range(X + 1, 102):
    if not a in p:
        right = a
        break 

if X - left > right - X:
    print(right)
else:
    print(left)

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

ans = 0
for a in range(X+1):
    for s in [-1,+1]:
        ans = X + s * a
        if P.count(ans) == 0:
            print(ans)
            return

import math
def i_input(): return int(input())


def i_map(): return list(map(int, input().split()))


def i_list(): return list(map(int, input().split()))


def i_row(N): return [int(input()) for _ in range(N)]


def i_row_list(N): return [list(map(int, input().split())) for _ in range(N)]

x,n= i_map()
pp=i_list()

nums=list(range(1000))
nums.append(-1)
for p in pp:
    nums[p]=10**3
ans=10**18
ch=10**18

for num in nums:
    if ch>abs(x-num):
        ch=abs(x-num)
        ans=num
print(ans)






from typing import List


def answer(x: int, n: int, p: List[int]) -> int:
    not_included = set(range(0, 102)).difference(p)
    return sorted(not_included, key=lambda i: abs(i - x))[0]


def main():
    x, n = list(map(int, input().split()))
    p = list(map(int, input().split()))
    print((answer(x, n, p)))


def __starting_point():
    main()

__starting_point()

x,n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
  sa = 102
  ans = []
  for i in range(x,102):
    if i not in p:
      if sa > i-x:
        sa = i-x
        ans = i
      elif sa == i-x:
        if ans > i:
          ans = i
  for i in range(x):
    if x-i-1 not in p:
      if sa > i+1:
        sa = i+1
        ans = x-i-1
      elif sa == i+1:
        if ans > x-i-1:
          ans = x-i-1
  print(ans)
else:
  print(x)

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

if N==0:
    print(X)
    return
poe=list(map(int,input().split()))
for i in range(101):
    if X-i not in poe:
        print((X-i))
        return
    elif X+i not in poe:
        print((X+i))
        return


X,N = map(int,input().split())
p = sorted([int(i) for i in input().split()])
a = X
b = X
for i in range(100):
    if(a not in p):
        print(a)
        return
    elif(b not in p):
        print(b)
        return
    else:
        a -= 1
        b += 1

x,n=map(int,input().split())
p=list(map(int,input().split()))
temp=100
for i in range(x-51,x+51):
    a=abs(x-i)
    if a<temp and i not in p:
        temp=a
        ans=[i]
    if a==temp and i not in p:
        ans+=[i]
print(min(ans))

x,n=map(int,input().split())
l=list(map(int,input().split()))
a=0
for i in range(100):
    if x-i not in l:
        ans=x-i
        a=i+1
        break
for i in range(100):
    if x+i not in l:
        ansb=x+i
        ab=i+1
        break
if a>ab:
    print(ansb)
else:
    print(ans)

import math
X, N = map(int, input().split())
P = list(map(int, input().split()))
ans_1 = X
ans_2 = X
while True:
    if ans_1 not in P:
        print(ans_1)
        return
    ans_1 -= 1

    if ans_2 not in P:
        print(ans_2)
        return
    ans_2 += 1

X,N = map(int,input().split())
p = list(map(int,input().split()))
diff = 0
while True:
    num_p = X + diff
    num_m = X - diff
    if num_m not in p:
        print(num_m)
        break
    elif num_p not in p:
        print(num_p)
        break
    else:
        diff += 1

""" 170/C
"""
import sys
import math
from functools import reduce
from bisect import bisect_left

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return [lambda _: readIntegerSet(m) for _ in range(0, n)]

def main(X, N, P):
    mP = {}
    for p in P:
        mP[p] = p

    if X not in mP:
        return X

    i = 0
    while True:
        if X-i not in mP:
            return X-i

        if X+i not in mP:
            return X+i

        i += 1


def __starting_point():
    _X, _N = readIntegerSet(2)
    _P = readIntegerSet(_N)

    print(main(_X, _N, _P))
__starting_point()

#!/usr/bin/env python3

import sys

input = iter(sys.stdin.read().splitlines()).__next__

sys.setrecursionlimit(10000)

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

bestr = 0
for r in range(0, 102):
   if r not in S:
      if abs(r-X) < abs(bestr-X):
         bestr = r

print(bestr)


X, N = map(int, input().split())
if N != 0:
  p = set(map(int, input().split()))
  for i in range(N):
    if X - i not in p:
      print(X - i)
      break
    elif X + i not in p:
      print(X + i)
      break
  else:
    print(X - i - 1)
else:
  print(X)

a,b = map(int,input().split())
s = list(map(int,input().split()))
num1 =0
num2 =0
if b ==0:
  print(a)
  return
for i in range(100):
    num1 = a-i
    num2 = a+i
    if not num1 in s and not num2 in s:
        print(num1)
        return
    if not num1 in s:
        print(num1)
        return
    if not num2 in s:
        print(num2)
        return

[X, N] = [int(i) for i in input().split()]
if N == 0:
    P = []
else:
    P = [int(i) for i in input().split()]

if P.count(X) == 0:
    print(X)
else:
    for i in range(100):
        if P.count(X-i) == 0:
            print(X-i)
            break
        elif P.count(X+i) == 0:
            print(X+i)
            break

x,n=map(int,input().split())
p=sorted([int(x) for x in input().split()])

if n==0: print(x); return;

ans=idx=10**9
for i in range(-500,500):
  for pi in p:
    if p.count(i)==0: 
      if ans>abs(i-x):
        ans=abs(i-x); idx=i
print(idx)

x,n=map(int,input().split())
l=list(map(int,input().split()))
flag=0
i=0
while flag==0:
    if x-i not in l:
        flag=1
        ansa=x-i
    i+=1
flag=0
i=0
while flag==0:
    if x+i not in l:
        flag=1
        ansb=x+i
    i+=1
if abs(ansa-x)<=abs(ansb-x):
    print(ansa)
else:
    print(ansb)

x, n = map(int, input().split())
p = list(map(int,input().split()))
p.sort()
s = x
d = 1
while s in p:
    s = s - d
    d = int((abs(d)+1)*d/abs(d)*(-1))
print(s)

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

p.sort()

def main():

    if len(p) == 0:
        print(X)
        return

    if X < p[0] and p[-1] < X:
        print(X)

    keep = True
    i = 0
    while keep:
        left_found = (X - i) not in p
        right_found = (X + i) not in p

        if left_found and right_found:
            print((X-i))
            keep = False
        elif left_found:
            print((X-i))
            keep = False
        elif right_found:
            print((X+i))
            keep = False


        i += 1


def __starting_point():
    main()

__starting_point()

#                               #
    # author : samars_diary #
    # 18-09-2020 │ 19:20:45 #
#                               #

import sys, os.path

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a,b=mii()
    if b==0: print(a) ; return
    c=lii();d=111;e=0
    for i in range(max(c)+2):
        if i not in c:
            if abs(i-a)<d:
                d=abs(i-a)
                e=i
    print(e)
                
for _ in range(1):
    solve()

x, n = map(int, input().split())
p = sorted(list(map(int, input().split())))
if x not in p:
    print(x)
else:
    for i in range(1, 100):
        x_p, x_m = x + i, x - i
        if x_m not in p:
            print(x_m)
            return
        if x_p not in p:
            print(x_p)
            return

X, N = map(int, input().split())
p = list(map(int, input().split()))
mini = 100000
for i in range(X + 200):
    if i in p: continue
    if abs(i - X) < mini:
        mini = abs(i - X)
        ans = i
print(ans)

x, n = map(int, input().split())
ppp = []
if n != 0:
    ppp = list(map(int, input().split()))
ans = 0
for i in range(101):
    if x - i not in ppp:
        ans = x - i
        break
    if x + i not in ppp:
        ans = x + i
        break
print(ans)

x, n = map(int,input().split())
L = list(map(int,input().split()))
l, r = x-1, x+1

if n == 0 or x not in L:
  print(x)
  return

while True:
  flg = True
  if l not in L:
    print(l)
    break
  elif r not in L:
    print(r)
    break
  l -= 1
  r += 1

x, n = [int(s) for s in input().split()]
p_set = set([int(s) for s in input().split()])
a = 0
while True:
    if x - a not in p_set:
        print(x - a)
        break
    if x + a not in p_set:
        print(x + a)
        break
    a += 1

x, n = map(int, input().split())
p = list(map(int,input().split()))
s = x
d = 1
while s in p:
    s = s - d
    d = int((abs(d)+1)*d/abs(d)*(-1))
print(s)

x, n = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))

a = 100
b = 0
for i in range(0, 102):
    if i not in p and abs(x - i) < a:
        a = abs(x - i)
        b = i

print(b)


X,N = (int(x) for x in input().split())
p = sorted(list((int(x) for x in input().split())))
if N == 0:
  print(X)
elif N == 1:
  if p[0] == X:
    print(X-1)
  else:
    print(X)
else:
  ans = float('inf')
  for z in range(0,p[0]):
    if (ans-X)**2 > (z-X)**2 :
      ans = z
  for i in range(N-1):
    for z in range(p[i]+1,p[i+1]):
      if (ans-X)**2 > (z-X)**2 :
      	ans = z
  for z in range(p[-1]+1,102):
    if (ans-X)**2 > (z-X)**2 :
      ans = z
  print(ans)

x, n = map(int, input().split())
p = [int(s) for s in input().split()]

min_val = 101
for i in range(102):
    if i not in p:
        if abs(i - x) < min_val:
            min_val = abs(i - x)
            ans = i
print(ans)

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

for i in range(x+1):
    for j in [-1, 1]:
        ans = x + i*j
        if not p.count(ans):
            print(ans)
            return


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

gap = x
ans = 0

for y in range(102):
  if y not in p:
    if abs(x - y) < gap:
      gap = abs(x-y)
      ans = y
print(ans)


x, n = list(map(int, input().split()))
min = 105
ans = 105
if n != 0:
    p = list(map(int, input().split()))
    for i in range(102):
        if i not in p:
            if abs(i - x) < min:
                min = abs(i - x)
                ans = i
else:
    ans = x
print(ans)


x,n = list(map(int,input().split()))
if n == 0:
  print(x)
  return
nums = list(map(int,input().split()))
cnt =0
while True:
  if x-cnt not in nums:
    print((x-cnt))
    break
  if x+cnt not in nums:
    print((x+cnt))
    break
  cnt +=1


import numpy as np

x, y = list(map(int, input().split()))
p = input().split()
pn = [int(tmp) for tmp in p]

if y == 0:
    ans = x
elif not np.where(np.array(pn) == x)[0].size:
    ans = x
else:
    for i in range(1, 100):
        x1 = x + i
        x2 = x - i
        if not np.where(np.array(pn) == x2)[0].size:
            ans = x2
            break
        elif not np.where(np.array(pn) == x1)[0].size:
            ans = x1
            break
        else:
            continue

print(ans)


x,n=map(int,input().split())
if n==0:
  print(x)
  return
p=[int(y) for y in input().split()]
a=0
for i in range(101):
  if x-a not in p:
    print(x-a)
    break
  elif x+a not in p:
    print(x+a)
    break
  a+=1

x, n = list(map(int, input().split()))
p = [int(v) for v in input().split()]
ans = None
if x not in p:
    ans = x
else:
    diff = 101
    for i in range(0, max(p) + 2):

        if abs(x - i) < diff and i not in p:
            ans = i
            diff = abs(x - i)
print(ans)


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

gap = x
ans = 0

for y in range(0,102):
  if y not in p:
    if abs(x - y) < gap:
      gap = abs(x-y)
      ans = y
      
print(ans)


#C問題

#ループ処理をスキップするコード→break,continue,return(関数方式)
x, n = map(int, input().split())
P = list(map(int, input().split()))
xm = x 
xM = x

for i in range(0,100):
    if n == 0:
        print(x)
        break
    xm = x - i
    xM = x + i
    mcounter = 0
    Mcounter = 0
    for j in range(len(P)):
        if xm == P[j]:
            mcounter += 1000
        if xM == P[j]:
            Mcounter += 1000
    if mcounter < 1000:
        print(xm)
        break
    if Mcounter < 1000:
        print(xM)
        break

x, n = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n):
    if p[i] - x >= 0:
        p[i] = 2 * (p[i] - x)
    else:
        p[i] = (x - p[i]) * 2 - 1
p = sorted(p)
i = 0
while i in p:
    i += 1
if i % 2 == 0:
    j = round(i / 2) + x
else:
    j = x - round((i + 1) / 2)
print(j)

x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
a = 101
b = 101
for i in range(x, 102):
    if i not in p:
        a = i
        b = i - x
        break
for i in range(x - 1, -101, -1):
    if a == x:
        break
    if i not in p:
        c = x - i
        if c <= b:
            a = i
            break
        else:
            break
print(a)


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

if N ==0 or X < min(p) or X > max(p):
    print(X)
else:
    for n in range(N+1):
        if not X - n in p:
            print(X - n)
            break
        elif not X + n in p:
            print(X + n)
            break

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

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

count = 0

flg = False

lis=[]

result=0

while True:
    
    up = X+count
    
    down = X-count
    
    if p.count(down) ==0:
        lis.append(down)
        flg = True
    
    if p.count(up)==0:
        lis.append(up)
        flg = True
        
    
    if flg ==True:
        break
    else:
        count+=1
        

lis.sort()

print((lis[0]))


from bisect import bisect

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

for i in range(100):
    if not(x-i in p):
        print(x-i)
        break
    if not(x+i in p):
        print(x+i)
        break

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

if(n):
    l = [0 for _ in range(102)]
    for i in p:
        l[i] = 1

    for i in range(101):
        if(l[x-i] == 0):
            ans = x-i
            break
        if(l[x+i] == 0):
            ans = x+i
            break
    print(ans)
else:
    print(x)


x,n=list(map(int,input().split()))
p=list(map(int,input().split()))
y=x
z=x
if x not in p:
    print(x)
    return
for i in range(2*len(p)):
    y-=1
    z+=1
    if y not in p:
        print(y)
        return
    if z not in p:
        print(z)
        return


x, n = map(int, input().split())
li_p = list(map(int, input().split()))
li_p.sort()
i = 0
while True:
    a = x - i
    b = x + i
    if not a in li_p:
        print(a)
        break
    elif a in li_p and not b in li_p:
        print(b)
        break
    elif a in li_p and b in li_p:
        i += 1


x,n = list(map(int,input().split()))
l = list(map(int,input().split()))
l.sort()



result = x
for i in range(100):
    if x in l:
        pass
    else:
        result = x
        break

    if x - i in l:
        pass
    else:
        if x - i >= 0:
            result = x - i
            break

    if x + i in l:
        pass
    else:
        if x + i <= 101:
            result = x + i
            break



print(result)



X,N=list(map(int,input().split()))
p=input()
def ans170(X:int, N:int, p:str):
    p_list=list(map(int,p.split()))
    count=1
    if len(p)==0:
        return X
    elif X not in p_list:
        return X
    else:
        while True:
            if X-count not in p_list:
                return X-count
                break
            elif X+count not in p_list:
                return X+count
                break
            else:
                count+=1
print((ans170(X,N,p)))


import sys

x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()

if n==0:
    print(x)
    return

if x not in p:
    print(x)
    return
    
q=list(i for i in range(p[0]-1,p[-1]+2))

for i in p:
    q.remove(i)

ans=[]
c=x+n
for i in q:
    if c>abs(x-i):
        c=abs(x-i)
        ans.clear()
        ans.append(i)
    if c==abs(x-i):
        ans.append(i)

print(min(ans))

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

min =10000
temp = 0
num = 10000

for i in range(-1000, 1000):
  temp = abs(x- i)
  
  if temp < min and i not in p:
    min = temp
    num = i
    
print(num)


x,n=map(int,input().split())
try:
  p=sorted([*map(int,input().split())])
except:
  print(x);return
for i in range(x+1):
  for s in [-1,1]:
    a=x+i*s
    if p.count(a)==0:
      print(a);return

m, n = map(int, input().split())
p = list(map(int, input().split()))
a=0

while True:
    if m-a not in p:
        print(m-a)
        break
    elif m+a not in p:
        print(m+a)
        break
    a+=1

x, n = map(int, input().split())

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

l = list()

k = list()

for i in range(102):
    if i not in p:
        l.append(i)

for i in range(len(l)):
    k.append(abs(x - l[i]))

m = k.index(min(k))

print(l[m])

X, N = map(int, input().split())
ps = list(map(int, input().split()))
bgr, smr = X, X
while bgr <= 100:
	if bgr not in ps:
		break
	bgr += 1
while smr >= 1:
	if smr not in ps:
		break
	smr -= 1
print(bgr) if bgr - X < X - smr else print(smr)


import bisect

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

A = {i for i in range(102)}

S = list(A - P)

T = bisect.bisect_left(S, X)

if T == 0:
    print((S[0]))
elif X - S[T-1] > S[T] - X:
    print((S[T]))
else:
    print((S[T-1]))


x, n = list(map(int,input().split()))
l = list(map(int,input().split()))
a = 0
ab = 0
for i in range(100):
    if x - i not in l:
        ans = x - i
        a = i + 1
        break
for i in range(100):
    if x + i not in l:
        ansb = x + i
        ab = i + 1
        break
if a > ab:
    print(ansb)
else:
    print(ans)


x,_ = list(map(int,input().split()))
p = list(map(int,input().split()))
x_l = x
x_u = x
while(True):
    if(not x_l in p):
        print(x_l)
        break
    if(not x_u in p):
        print(x_u)
        break
    x_l -= 1
    x_u += 1

x, n = list(map(int, input().split()))
ppp = []
if n != 0:
    ppp = list(map(int, input().split()))
plus_x = x
minus_x = x
ans = 0
if x not in ppp:
    ans = x
else:
    while minus_x + 100 > x or plus_x + 100 > x:
        minus_x -= 1
        if minus_x not in ppp:
            ans = minus_x
            break
        plus_x += 1
        if plus_x not in ppp:
            ans = plus_x
            break
print(ans)


import bisect
X, N=map(int, input().split())
if N==0:print(X);return
p=sorted(list(map(int, input().split())))
#print(p)
m=min(p)-1
M=max(p)+1
#for i in range(m,M+1):
#  p.append(i)
#p=sorted(p)
m=X;i=0
for i in range(m,min(p)-2,-1):
  if i not in p:break
M=X;j=0
for j in range(M,max(p)+2):
  if j not in p:break
if abs(i-X)==abs(j-X):print(min(i,j))
elif abs(i-X)<abs(j-X):
  print(i)
else:print(j)

x,n=list(map(int, input().split()))
p=list(map(int, input().split()))
dif=0
for i in range(100):
    if x-i not in p:
        print((x-i))
        break
    elif x+i not in p:
        print((x+i))
        break


X,N = map(int,input().split())
p = list(map(int,input().split()))
count = -1
while True:
    count +=1
    if X-count not in p:
        print(X-count)
        break
    elif X+count not in p:
        print(X+count)
        break

#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X,N=MI()
    P=set(LI())

    for i in range(N+1):
        if(X-i not in P):
            print(X-i)
            return 
        if(X+i not in P):
            print(X+i)
            return
    

def __starting_point():
    main()
__starting_point()

import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
  X,N = i_map()
  if N == 0:
    print(X)
    return
  P = i_list()
  dis = INF
  ans = 0
  for i in range(105):
    if i not in P and abs(X - i) < dis:
      dis = abs(X - i)
      ans = i
  print(ans)
 
 
def __starting_point():
    main()
__starting_point()

s,n = input().split(" ")

min = 100

if int(n) != 0:
  num = input().split(" ")
else:
  num = []

for i in range(-102,102):
  if str(i) not in num:
    cal = abs(int(s) - int(i))
    
  if min > cal:
    min = cal
    ans = int(i)

print(ans)

X,N=map(int,input().split());*P,=map(int,input().split());print(min([i for i in range(102)if(i in P)^1],key=lambda i:abs(i-X)))

x,n = map(int,input().split())
p = list(map(int,input().split()))
 
a = [i for i in range(102)]
 
b = list(set(a)-set(p))
ans = 100
for i in range(len(b)):
    c = abs(b[i]-x)
    ans = min(ans,c)
 
up = x+ans
down = x-ans
 
if up in set(p):
    print(down)
    return
elif down in set(p):
    print(up)
    return
print(min(up,down))

X,N=list(map(int,input().split()))
p=list(map(int,input().split()))
ans=0
for i in range(1,102):
    if i not in p:
        if abs(X-i)<abs(X-ans):
            ans=i
print(ans)


X,N = list(map(int, input().split()))
flg=False
i=1

if N==0:
  Ans=X
else:
  S=list(map(int, input().split()))
#  S.sort()
  if X not in S:
    Ans=X
    flg=True
    
  while not flg:
    if X-i not in S:
      Ans=X-i
      flg=True
      break
    elif X+i not in S:
      Ans=X+i
      flg=True
      break
    else:
      i+=1
      
print(Ans)


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

sa_min=100

"""
sa=[]
for i in range(N):
    sa.append(p[i]-X)
"""

for i in range(102):
    if sa_min>abs(i-X) and (not i in p):
        sa_min=abs(i-X)
        ans=i

if N==0:ans=X

print(ans)

X, N = map(int,input().split())
if N == 0:
  P = []
else:
  P = list(map(int, input().split()))
  P = sorted(P)
assert len(P) == N
cands = []
# 下側検索
x = X
while True:
  if x not in P:
    cands.append(x)
    break
  x -= 1
# 上側検索
x = X
while True:
  if x not in P:
    cands.append(x)
    break
  x += 1
a,b = cands
if abs(a - X) > abs(b - X):
  print(b)
else:
  print(a)

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

if N != 0: 
  while X-k in p and X+k in p:
   k += 1
  if X-k not in p:
   print((X-k))
  else:
   print((X+k))
else:
  print(X)
  

    


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

ans = 0

for i in range(1,102):
    if i not in list(p):
        if abs(x-i)<abs(x-ans):
            ans = i

print(ans)


x, n = map(int, input().split())

if n == 0:
  print(x)
  return
  
pp = list(map(int, input().split()))
  
for i in range(52):
  x_p = x + i
  x_m = x - i
  if x_m not in pp:
    print(x_m)
    return
  elif x_p not in pp:
    print(x_p)
    return 

X, N=map(int, input().split())
if N==0:print(X);return
p=sorted(list(map(int, input().split())))

m=X;i=0
for i in range(m,min(p)-2,-1):
  if i not in p:break
M=X;j=0
for j in range(M,max(p)+2):
  if j not in p:break
if abs(i-X)==abs(j-X):print(min(i,j))
elif abs(i-X)<abs(j-X):
  print(i)
else:print(j)

x,n = map(int,input().split())
p = [int(s) for s in input().split()]
for i in range(x+1):
    for j in range(-1,+2):
        a = x + i * j
        if p.count(a) == 0:
            print(a)
            return

X, N = map(int, input().split())
if N != 0:
  p = list(map(int, input().split()))
  for i in range(N):
    if X - i not in p:
      print(X - i)
      break
    elif X + i not in p:
      print(X + i)
      break
  else:
    print(X - i - 1)
else:
  print(X)

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

l = [i for i in range(102)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])

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

ans = 0
d_ans = 101

for i in range(-1, 102):
    for j in p:
        if i == j:
            break
    else:
        d = abs(x - i)
        if d_ans > d:
            ans = i
            d_ans = d
        elif d_ans == d and ans > i:
            ans = i

print(ans)


x,n=map(int,input().split())
p=list(map(int,input().split()))
num1=0
num2=0
if(n==0):
    print(x)
    return
for i in range(100):
    num1=x-i
    num2=x+i
    if(not num1 in p and not num2 in p):
        print(num1)
        return
    elif(not num2 in p):
        print(num2)
        return
    elif(not num1 in p):
        print(num1)
        return

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

for i in range(100):
    num = x - i
    if num not in p:
        print(num)
        return
    num = x + i
    if num not in p:
        print(num)
        return



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

l = x
r = x
while True:
    if (l not in p) and (r not in p):
        print(l)
        return
    elif l not in p:
        print(l)
        return
    elif r not in p:
        print(r)
        return
    l -= 1
    r += 1


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

x, n = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

tmp = 0
res = 0

P = np.array(P) - x

while True:
    if not -res in P:
        res *= -1
        break
    if not res in P:
        break
    res += 1
res += x

print(res)


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

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

count = 0

flg = False

lis=[]

result=0

while True:
    
    up = X+count
    
    down = X-count
    
    if p.count(down) ==0:
        lis.append(down)
        flg = True
    
    if p.count(up)==0:
        lis.append(up)
        flg = True
        
    
    if flg ==True:
        break
    else:
        count+=1
        

lis.sort()

print((lis[0]))
    


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

mind = 10**10
ans = -102
for i in range(-101, 102):
    dist = abs(X - i)
    if mind > dist:
        if i not in pi:
            ans = i
            mind = dist


print(ans)


x, n = map(int,input().split())
L = list(map(int,input().split()))

if n == 0 or x not in L:
  print(x)
  return

for i in range(102):
  if (x-i) not in L:
    print(x-i)
    break
  elif (x+i) not in L:
    print(x+i)
    break

import bisect
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    p = set(map(int, input().split()))
    num_list = set([i for i in range(-1, 102)])
    num_list = sorted(list(num_list ^ p))
    nummin = num_list[bisect.bisect_left(num_list, X)]
    nummax = num_list[bisect.bisect_right(num_list, X)]
    if nummin == nummax:
        nummin = num_list[bisect.bisect_left(num_list, X)-1]
    if X-nummin <= nummax-X:
        print(nummin)
    else:
        print(nummax)

x, n = list(map(int, input().split()))


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

a = 0


while True:
    if x - a not in p:
        print((x - a))
        break
    elif x + a not in p:
        print((x + a))
        break
    a += 1


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, N = na()
p = na()
kouho = []
for i in range(-100, 200):
    if i in p:
        continue
    kouho.append((abs(X - i), i))
print(min(kouho)[1])

x, n = [int(s) for s in input().split()]
p_set = set([int(s) for s in input().split()])
a = 0
while True:
    for i in [-1, 1]:
        y = x + i * a
        if y not in p_set:
            print(y)
            return
    a += 1

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

ans = None
diff = 1000

if X not in p:
    ans = X
else:
    for i in range(-1, max(max(p), X)+2):
        if i in p:continue
        if abs(X - i) < diff:
            diff = abs(X - i)
            ans = i

print(ans)


x, n = map(int,input().split())
L = list(map(int,input().split()))
l, r = x-1, x+1

if n == 0 or x not in L:
  print(x)
  return

while True:
  if l not in L:
    print(l)
    break
  elif r not in L:
    print(r)
    break
  l -= 1
  r += 1

def main(X, N, P):
    ans = None
    min_dis = 1e8
    for i in range(102):
        #print(f"loop {i}")
        if i in P:
            continue
        #print(abs(X - i))
        if abs(X - i) < min_dis:
            ans = i
            min_dis = abs(X - i)
            #print(ans)

    return ans


def __starting_point():
    X, N = list(map(int, input().split()))
    P = list(map(int, input().split()))
    ans = main(X, N, P)
    print(ans)

__starting_point()

X, N = list(map(int, input().split()))
if N == 0:
    print(X)
    return
p = list(map(int, input().split()))

p = sorted(p)
flag = 0
x = 0
while (flag == 0):
    n = X - x
    if n in p:
        n = X + x
        if n in p:
            x += 1
        else:
            flag = 1
    else:
        flag = 1
print(n)


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

for i in range(100):
    num = x - i
    if num not in p:
        print(num)
        return
    num = x + i
    if num not in p:
        print(num)
        return



def ri():
    return int(input())


def rii():
    return [int(v) for v in input().split()]


def solve():
    X, N = rii()
    P = set(rii())
    n = m = float("inf")
    if not P:
        print(X)
        return

    for i in range(min(P)-1, max(P)+2):
        if i not in P:
            d = abs(i - X)
            if d == m:
                n = min(n, i)
            elif d < m:
                m = d
                n = i
    
    print(n)



def __starting_point():
    solve()
__starting_point()

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

N = y[0]
Q = y[1]

if(Q==0):print(N);return;
y = [int(i) for i in input().split()]
#y.append(N)
ans=[]

for i in range(102):
    if i in y: continue;
    ans.append(i)

for i in range(0,-102,-1):
    if i in y: continue;
    ans.append(i)

t = abs(N-ans[0])
anss=0;
for i in ans:
    if (abs(N-i) < t): anss = i;t = abs(i-N);

print(anss)


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