peterverebics/CodeNet_Python_118 huggingface dataset:
X, N = map(int, input().split())
if N > 0:
    P = list(map(int, input().split()))
    A = [0]*102
    cnt = 0
    res = float('Inf')
    for n in range(N):
        A[P[n]] += 1
    for a in A:
        if a == 0:
            total = abs(X - cnt)
            if res > total:
                res = total
                man = cnt
        cnt += 1
    print(man)
else:
    print(X)
X,N=map(int,input().split())
P=list(map(int,input().split()))

ans=[float("inf"),float("inf")]
for i in range(102):
    if i in P:
        continue
    tmp=abs(i-X)
    if tmp<ans[0]:
        ans[0]=tmp
        ans[1]=i
print(ans[1])
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)
      exit(0)
import numpy as np
x,n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
ll = np.ones(1)*(-1)
for i in range(102):
    ll = np.append(ll,int(i))
    
for j in p:
    ll= ll[~(ll == j)]

if len(ll) == 0:
    print(x)
    exit()
# print(ll)

a = np.zeros(len(ll))
for i in range(len(ll)):
    a[i]=abs(x-ll[i])
# print(ll)
print(int(ll[np.argmin(a)]))
x,n=map(int,input().split())
P=list(map(int,input().split()))
Q=P.copy()

for i in range(n):
    P[i]=abs(P[i]-x)
P.sort()
count = -1
for i in range(n):
    if (i+1)//2 == P[i]:
        continue
    else:
        count=(i+1)//2
        break

if n%2==0 and count==-1:
    count=n//2
elif n%2==1 and count==-1:
    count=(n+1)//2

if n==0:
    print(x)
elif x-count in Q:
    print(x+count)
else:
    print(x-count)
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
else:
  print(x)
  exit()

for j in range(100):
  if all(x-j != i for i in p):
    print(x-j)
    exit()
  elif all(x+j != i for i in p):
    print(x+j)
    exit()
X, N = map(int, input().split())
P = list(map(int, input().split()))
differ=[]

if N == 0:
    print(X)
else:
    for i in range(0,102):
        if i not in P:
            differ.append(abs(X - i))
        else:
            differ.append(1000)
    ans = differ.index(min(differ))
    print(differ)
    print(ans)
x, n = map(int, input().split())
if n ==0:
    print(x)
else:
    p = list(map(int, input().split()))
    q = list(range(101))
    a = x
    for i in range(x, 0, -1):
        if p.count(i) == 0:
            a = i
            break

    b = x
    for i in range(x, 101):
        if p.count(i) == 0:
            b = i
            break

    if abs(x-a) > abs(x-b):
        print(b)
    else:
        print(a)
import sys
x,n = map(int,input().split())
a = list(map(int,input().split()))
if x in a:
    s = 0; t = 0
    for i in range(x+1,100):
        if i not in a:
            s = i
            sys.exit()
    for j in reversed(range(x-1,-100)):
        if i not in a:
            t = j
            sys.exit()
    if abs(x-s) < abs(x-t):
        print(s)
    elif abs(x-s) > abs(x-t):
        print(t)
else:
    print(x)
import bisect
X, N=map(int, input().split())
if N==0:print(X);exit()
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

print(min(i,j))
X, N = map(int, input().split())
#X = 100
#N = 0

p = list(map(int, input().split()))
#p = [4,7,10,6,5]
if N == 0:
    print(X)
    exit()

p.sort()
all = [i for i in range(1,101)]
for i in p:
    if i in all:
        all.remove(i)
if len(all) == 0:
    exit()
min = 101
min_k = 0
for k,i in enumerate(all):
    tmp = abs(X-i)
    if min > tmp:
        min = tmp
        min_k =k
print(all[min_k])
import numpy as np
X,N=map(int,input().split())
p=np.array(list(map(int,input().split())))
ans=np.array([X,X])
while True:
  ans+=[-1,1]
  if ans[0] not in p:
    print(ans[0])
    exit()
  if ans[1] not in p:
    print(ans[1])
    exit()
x,n=map(int,input().split())
if n==0:
    print(x)
    exit()
elif n==100:
    print(-1)
    exit()
List=list(map(int,input().split()))
num=list(range(1,101))
min_num=0
for i in range(len(List)):
    if num.count(List[i])>=1:
        num.remove(List[i])
for i in range(len(num)):
    if abs(num[i]-x)<abs(min_num-x):
        min_num=num[i]
print(min_num)
x, n = map(int,input().split())

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

p.append(x)

d =100
num = 0

if n == 0:
    num = x
else:
    for i in range(-1,101):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
print(num)
x, n = map(int, input().split())
seisulist = list(map(int, input().split()))
if n != 0 and max(seisulist) > x:
    size = max(seisulist) + 1
else:
    size = x + 1
numlist = [i for i in range(-1*size,size) if i not in seisulist]
xretu = [x]*len(numlist)
hikizan = [abs(s-t) for (s, t) in zip(numlist, xretu)]
sa = min(hikizan)
if x-sa not in seisulist:
    print(x-sa)
else:
    print(x+sa)
#abc170
x, n = map(int, input().split())
ln = []
if n == 0:
  pass
else:
  ln = list(map(int, input().split()))
i = 0

while i < 5:
    
    
    if (x-i in ln) == False:
        print(x-i)
        break
    elif (x+i in ln) == False:
        print(x+i)
        break  
    else:
        i +=1
X,N = map(int, input().split())
if N==0:
    print(X)
    exit()
else:
    p=list(map(int,input().split()))
    A=[i for i in range(100) if i not in p]

mini=200
minip=200
for i in range(N):
    if abs(p[i]-X) <=mini:
        mini= abs(p[i]-X)
        minip=p[i]
        

minimini=200
answer=200
for a in A:
    if abs(a-minip)<minimini:
        minimini=abs(a-minip)
        answer=a

print(answer)
x,n = map(int, input().split())
valid = [1] *101
p = list(map(int, input().split()))
for i in range(n):
	valid[p[i]] = 0

for j in range(x):
	print(x,j,x-j,x+j)
	if((x-j) >= 1):
		if(valid[x-j] == 1):
			print(x-j)
			break
	elif((x+j) <= 100):
		if(valid[x+j] == 1):
			print(x+j)
			break
x,n=map(int,input().split())
p=list(map(int,input().split()))
q=list(range(-1,101))
for i in range(n):
    q.remove(p[i])
ans=0
for i in q:
    if abs(x-i)==abs(x-ans):
        ans=min(i,ans)
    elif abs(x-i)<abs(x-ans):
        ans=i
print(ans)
# coding: utf-8

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

for i in range(N // 2):
  if not(X - i in P):
    Ans = X - i
    break
  elif not (X + i in P):
    Ans = X + i
    break

print(Ans)
x, n = map(int, input().split())
try:
  p = list(map(int, input().split()))
except EOFError:
  print(100)
  exit()
old_diff = 10000
for i in range(1, 101):
  if i in p:
    continue
  else:
    diff = abs(x-i)
    if diff < old_diff:
      ans = i
      old_diff = abs(x-i)

try:
  print(ans)
except:
  print()
import collections
X, N = map(int, input().split())
list = list(map(int, input().split()))

c = collections.Counter(list)
res1=-1000
res2=-1000

for i in range (0, 100):
  if(c[X+i]==0):
    res1=X+i
    if(c[X-i]==0):
      res2=X-i
    break

if(abs(X-res1)<abs(X-res2)):
  print(res1)
else:
  print(res2)
import sys

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

YES = "Yes"  
NO = "No" 

for i in range(X+1):
    two = i
    four = X-i
    
    if 2 * two + 4 * four == Y:
        print(YES)
        sys.exit()

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

arr = [0] * 1000
for i in p:
    arr[i] = 1

ans1 = 0
for i in range(x, 0, -1):
    if arr[i] == 0:
        ans1 = i
        break

#print(arr)

ans2 = 0
for i in range(x, 102):
    if arr[i] == 0:
        ans2 = i
        break

if ans1 == 0:
    print(ans2)
else:
    if abs(ans1-x) <= abs(x-ans2):
        print(ans1)
    else:
        print(ans2)
X, N = map(int, input().split())
if N == 0:
    print(X)
    quit()
p = set(map(int, input().split()))
not_p = sorted(set(range(1, 101)) - p)
ans = 0
minval = 101
for i in not_p:
    if minval > abs(X - i):
        minval = abs(X - i)
        ans = i
print(ans)
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

cnt = [0] *101
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 101):
    if cnt[i] == 0:
        ans1 = i
        break

for i in range(1, x):
    if cnt[i] == 0:
        ans2 = i

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)
def main():
    X,N  = map(int, input().split()) 
    c=list(map(int, input().split()))
    XY = [True]*(101)

    for i in range(len(c)):
        XY[c[i]]=False

    ans = 0
    sa = 10000

    for i in range(1,101):
        if XY[i]:
            if sa > abs(X-i) :
                ans = i
                sa = abs(X-i)
    print(ans)


if __name__ == '__main__':
    main()
target = input().split()
target = [int(i) for i in target]
arr = input().split()
arr = [int(i) for i in arr]

if len(arr)==0:
  print(target[0])
else:
  i=0
  while(1):
    if target[0]-i in arr:
      i+=1
    else:
      print(target[0]-i)
      break
nums=[int(s) for s in input().split()]

x=nums[0]
n=nums[1]

if n==0:
  print(x)
else:
  row=[int(s) for s in input().split()]
  ls=[]
  for i in range(101):
    if i not in row:
      ls.append(abs(i-x))

  ls.sort()
  if x-ls[0] not in row and x-ls[0]>=0:
    print(x-ls[0])
  else:
    print(x+ls[0])
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


x,n=MAP()
if n==0:
    print(x)
    exit()
a=LI()
l=-1;r=-1
for i in range(1,101):
    if x-i not in a:
        l=x-i
        break
for i in range(1,101):
    if x+i not in a:
        r=x+i
        break
if abs(r-x)>=abs(l-x):
    print(l)
else:
    print(r)
x,n = map(int,input().split())
if n==0:
    print(x)
else:
    p = list(map(int,input().split()))
    for i in range(1,n+10):
        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())
if N:
  P = list(map(int, input().split()))
  distance = 10000
  ans = 0
  for cadi in range(100, 0, -1):
    if not cadi in P :
      if distance >= ( cadi - X ) * ( cadi - X ):
        distance = ( cadi - X ) * ( cadi - X )
        ans = cadi
  print(ans)
else:
  print(X)
def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    _near = -1
    for i in range(101):
        if i in p:
            continue
        if abs(_near - x) > abs(i - x):
                _near = i
    print(_near)


if __name__ == "__main__":
    main()
import sys

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

if n == 0:
  print(x)
  sys.exit()
  
if n == 1:
  print(abs(x - int(input())))
  sys.exit()

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

p.sort()
min = [100, 100]

for i in range(100):
  if i in p:
    continue
  hoge = abs(x - i)
  if min[0] > hoge:
    min[0] = hoge
    min[1] = i

print(min[1])
import math
x,n  = map(int,input().split())
if n==0:
    print(x)
    exit()
p = [int(i) for i in input().split()]


max_ = max(p)



a= [i+1 for i in range(max_)]
aa = [-max_+i+1 for i in range(max_)]
m=0
for i in p:
    a[i-1]=100000
min_=100000

for j in aa:
    b=abs(j-x)
    if min_ > b:
        min_=b
        m = j
for i in a:
    b = abs(i-x)
    if min_ > b:

        min_=b
        m = i
print(m)
x, n = map(int,input().split())

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

p.append(x)

d =100
num = 0

if n == 0:
    num = x
else:
    for i in range(-1,102):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
print(num)
# import math
# x, y = map(int, input().split())
# a = (4 * x - y) / 2
# if a >= 0 and a <= x and a == math.ceil(a):
#     print('Yes')
# else:
#     print('No')
x, n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
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
x,n = map(int, input().split())
a = list(map(int, input().split()))
candicate = []
for i in range(101):
  exist = False
  for d in a:
    if i == d:
      exist = True
      break
  if exist == False:
    candicate.append(i)

for j in range(len(candicate) - 1):
  if candicate[j] == x or candicate[j + 1] == x:
    print(x)
    break
  elif candicate[j] < x and x < candicate[j+1]:
    if abs(candicate[j] - x) <= abs(candicate[j+1] - x):
      print(candicate[j])
    else:
      print(candicate[j+1])
xn=input().split()
x=int(xn[0])
n=int(xn[1])

data=input().split()
for i in range(100):
    for d in data:
        if int(d) != x-i:
            print(int(d))
            break
        elif int(d) != x+i:
            print(int(d))
            break
    else:
        continue
    break
X,N=[int(s) for s in input().split()]
p = [int(s) for s in input().split()]
prelist =  list(range(1,101))
a =100

for i in range(len(p)):
    prelist.remove(p[i])

for j in range(len(prelist)):
    if(abs(X-a) != min(abs(X-a),abs(X-prelist[j]))):
        a = prelist[j]
print(a)
x, n = map(int, input().split())
p = list(map(int, input().split()))

def main():
    if len(p) == 0:
        print(x)
        return

    ans_l = list(range(x-15, x+15))

    diff_l = list(set(p) ^ set(ans_l))
    diff_l.sort()

    cnt = 100
    ans = 100
    for i in range(0, len(diff_l)):
        check = abs(diff_l[i]-x)
        if check < cnt:
            cnt = check
            ans = diff_l[i]
    print(ans)
    return

main()
X,N = map(int,input().split())
p = list(map(int, input().split()))
num=list(range(-100,101))
for i in range(N):
    num.remove(p[i])
min_=210
for i in range(len(num)):
    s=abs(X-num[i])
    if s<min_:
        min_=s
        min_list=[num[i]]
    elif s==min_:
        min_list.append(num[i])
print(min(min_list))
import sys
X, N = map(int, input().split())
P = list(map(int, input().split()))

if len(P) == 0 or not X in P:
    print(X)
    sys.exit()

flg = 1000
ans = 1000
m = max(P)
itera = list(range(1, m + 1))
itera.reverse()

for i in itera:
    if not i in P and flg > abs(X - i):
        flg = abs(X - i)
        ans = min(ans, i)

if ans == 1000:
    if abs(X - m - 1) <= X:
        ans = m + 1

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

def main():
    if len(p) == 0:
        print(x)
        return

    ans_l = list(range(x-10, x+10))

    diff_l = list(set(p) ^ set(ans_l))
    diff_l.sort()

    cnt = 100
    ans = 100
    for i in range(0, len(diff_l)):
        check = abs(diff_l[i]-x)
        # print(check)
        if check < cnt:
            cnt = check
            ans = diff_l[i]
    print(ans)
    return

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

result = 0
if N == 0:
    result = X
else:
    list = [i for i in range(101)]
    for i in P:
        list.remove(i)
    if len(list) == 0:
        result  = 0
    else:
        min = 100
        for i in list:
            if min > abs(X-i):
                min = abs(X - i)
                result = i
print(result)
X, N = map(int, input().split())
P = list(map(int, input().split()))
if N == 0:
    print(100)

else:
    min_abs = 100
    min_abs = min([abs(X-i) for i in range(100) if not i in P])
    min_abs


    ans_candi = [i+X for i in range(-min_abs, min_abs+1) if not i+X in P]
    ans = min(ans_candi)
    print(ans)
X,N=[int(x) for x in input().split(" ")]
if N==0: print(X)
else:
    a=[int(x) for x in input().split(" ")]
    i=1
    res=0
    if not X in a:
        res=X
    while True:
        X+=i*(-1)**i
        if not X in a:
            res=X
            break
        i+=1
    print(res)
X, N = map(int, input().split())
if (N == 0):
  print(X)
else:
  nums = list(map(int, input().split()))
    
  nums.sort()
  low = nums[0]
  high = nums[-1]
  minDiff = 100000000
  minNum = -1
  for i in range(1, 101):
    if i in nums:
      continue
    else:
      Dif = abs(X-i)
    if (Dif < minDiff):
      minDiff = Dif
      minNum=i

  if (minNum == -1):
    print(X)
  else:
    print(minNum)
import sys

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

if(len(arr) == 0):
    print(x)
    sys.exit()

if(x in arr):
    print(x)
    sys.exit()

i = 1
while True:
    if(not (x - i in arr)):
        print(x - i)
        sys.exit()
    
    if(not (x + i in arr)):
        print(x + i)
        sys.exit()
    i += 1
X, N = map(int, input().split())
P =  set(map(int, input().split()))
Nums = set(range(1, 101))
Nums = Nums - P
sorted(Nums)


minNum = 99999;
minIndex = 0;
for n in Nums:
    if abs(X - n)< minNum:
        minNum = abs(X - n)
        minIndex = n

print(minIndex)
tmp = list(map(int, input().split()))
x = tmp[0]
n = tmp[1]
if n == 0:
    print(x)
    exit()

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

i = 1

while True:
    if not x-i in p:
        print(x-i)
        break
    if not x+i in p:
        print(x+i)
        break
    i += 1
x,n=map(int,input().split())
a=list(map(int,input().split()))
if n==0:
  print(x)
else:
  for i in range(n):
    y=x-i
    if y not in a:
      print(y)
      break
    z=x+i
    if z not in a:
      print(z)
      break
x,n,*a=map(int,open(0).read().split())
b=[1]*101
for i in a:
    b[i]=0
c=1000 
ans=0
for i in range(101):
    if b[i] and c>=abs(x-i):
        c=abs(x-i)
        ans=i
print(ans)
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

Flag = True
i = 1
while Flag:
    if x - i not in p:
        print(x - i)
        break
    elif x + i not in p:
        print(x + i)
        break
    i += 1
import numpy as np
X, N = map(int, input().split())
if N > 0:
  l1=list(map(int,input().split()))
else:
  l1=[]
ans = X
l2 = np.array([i for i in range(1,11)])

l3 = set(l1) ^ set(l2)  

for item in l3:
#  print("item",item)
#  print("X-item",(X - item)**2)
#  print("X-ans",(X - ans)**2)  
  if ((X - item) ** 2) == ((X - ans) ** 2):
    if item < ans:
      ans = item
  elif  ((X - item) ** 2) < ((X - ans) ** 2):
    ans = item
print(ans)
x,n = map(int,input().split())
if n == 0:
    print(x)
    exit()
l = set(list(map(int,input().split())))
for i in range(1,max(x,100-x)+1):
    if x-i not in l:
        print(x-i)
        exit()
    if x+i not in l:
        print(x+i)
        exit()
x, n = map(int, input().split())

if n == 0:
    # input()
    print(x)
else:
    l = list(map(int, input().split()))
    l.sort()
    small = x
    large = x
    while small in l and large in l:
        small -= 1
        large += 1
    if x - small > large - x:
        print(large)
    else:
        print(small)
import sys
 
x, n = map(int, input().split())
 
if n == 0:
  print(x)
  sys.exit()
  
if n == 1:
  print(abs(x - int(input())))
  sys.exit()
 
p = list(map(int, input().split()))
 
p.sort()
min = [100, 100]
 
for i in range(101):
  if i in p:
    continue
  hoge = abs(x - i)
  if min[0] > hoge:
    min[0] = hoge
    min[1] = i
 
print(min[1])
X, N = map(int, input().split())

if N > 0:
    p = set(map(int, input().split()))
else:
    print(X)
    exit()

if X not in p:
    print(X)
    exit()

for i in range(1,50):
    if X-i not in p:
        print(X-i)
        exit()
    elif X+i not in p:
        print(X+i)
        exit()

print(X)
a,b = map(int,input().split())
if(b != 0):
  c = list(map(int,input().split()))
else:
  print(a)
  exit()
ans = 0
for i in range(100):
  if(a+i not in c):
    if(a+i > 101):
      break
    else:
      ans = a+i
      break
for i in range(100):
  if(a-i not in c):
    if(a-i < 0):
      break
    else:
      if(abs(ans-(a-i)) < abs(a-ans)):
        ans = a-i
      elif(abs(ans-(a-i)) == abs(a-ans)):
        ans = min(a-i,ans)
      break
print(ans)
x,n = map(int,input().split())

if n == 0:
  print(x)
  exit()

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

x1,x2 = x,x
for i in range(1000):
  x1 -= 1
  x2 += 1
  if x1 not in p:
    print(x1)
    exit()
  if x2 not in p:
    print(x2)
    exit()
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    ans = x
    absol = 1000

    for i in range(1, 101):
        if i not in p:
            if abs(i - x) < absol:
                absol = abs(i - x)
                ans = i
    print(ans)

if __name__ == '__main__':
    main()
import math

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

  q = [int(i)+1 for i in range(100)]
  #print(q)

  for i in p:
    q.remove(i)

  ans = 0
  r0 = 101
  for j in q:
    r = abs(j-X)
    if r0 > r:
      r0 = r
      ans = j
  print(ans)
x, n = map(int, input().split())
if n == 0:
  print(x)
else:
  p = list(map(int, input().split()))
  p.sort()
  p1 = {i for i in range(p[-1])}
  p = set(p)
  p2 = p1 - p
  p2 = list(p2)
  absv = x
  for i in range(len(p2)):
    if absv > abs(x - p2[i]):
      absv = abs(x - p2[i])
  print(x - absv)
def main():
    x,n = map(int,input().split())
    p = list(map(int,input().split()))
    ans = -100
    for i in range(-1,101):
        if i not in p and abs(i-x) < abs(ans-x):
            ans = i
    print(ans)
    
    return

if __name__ == '__main__':
    main()
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X, N = map(int, rl().split())
    p = set(map(int, rl().split()))
    
    ans = -1
    d_min = 1000
    for i in range(101):
        if i not in p:
            if abs(X - i) < d_min:
                d_min = abs(X - i)
                ans = i
    print(ans)


if __name__ == '__main__':
    solve()
import numpy as np

X, N = map(int, input().split())
P = set(map(int, input().split()))
Q = set(range(101))
P = np.array(list(Q - P))
Q = np.abs(P - X)
Q = np.where(Q == Q.min())

print(P[Q].min())
def main():
    x,y = list(map(int, input().split()))

    if y == 0:
        print(x)
        exit()
    nums = list(map(int, input().split()))
    ans = 101
    for i in range(1, 101):
        if i not in nums:
            ans = ans if abs(ans-x) <= abs(i-x) else i
    print(ans)



if __name__ == '__main__':
    main()
x,n=map(int,input().split())
p=[int(x) for x in input().split()]
min=x
gap=x
for i in range(102):
	if i in p:
		continue
	else:
		if abs(x-i) < gap:
			gap=x-i
			min=i
print(min)
X,N = map(int,input().split())
p = list(map(int, input().split()))
n =max(X,N)

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:
    continue
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
p=list(map(int,input().split()))

c=[]
ans=100000
b=[]
for i in range(-1000,1001):
  c.append(i)
for i in range(n):
  c.remove(p[i])
  
for i in range(len(c)):
  sa=abs(x-c[i])
  if ans>sa and sa!=0:
    ans=sa
    
for i in range(len(c)):
  if ans==abs(x-c[i]):
    b.append(c[i])

if ans==10000:
  print(x)
else:
  b.sort()
  print(b[0])
x, n = list(map(int, input().split()))
ps = list(map(int, input().split())) if n else []

pss = [0] * 101
for p in ps:
    pss[p] = 1

#print(pss)
for i in range(101):
    if x - i > -1 and pss[x - i] == 0:
        print(x - i)
        break
    if x + i < 101 and pss[x + i] == 0:
        print(x + i)
        break
n, x = map(int, input().split())
p = set(map(int, input().split()))

ans = 0
for i in range(1, 102):
  if i in p:
    continue
  if i < x:
    ans = i
  elif x - ans > i - x:
    ans = i
    break
print(ans)
x, n = map(int, input().split())
p = list(map(int, input().split()))
s = 101
ans = 101
for i in range(-100,100+1):
    if not i in p:
        if s > abs(x-i):
            s = abs(x-i)
            ans = i
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(101):
    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=[int(x) for x in input().split(" ")]
if N==0: 
    a=input()
    print(X)
else:
    a=[int(x) for x in input().split(" ")]
    i=1
    res=0
    if not X in a:
        res=X
    while True:
        X+=i*(-1)**i
        if not X in a:
            res=X
            break
        i+=1
    print(res)