peterverebics/CodeNet_Python_118 huggingface dataset:
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))

min_ = 100
for i in range(100):
    cur = i + 1
    if cur in P:
        continue
    diff = abs(X - cur)
    if diff < min_:
        min_ = diff

front = X - min_
back = X + min_
if front not in P:
    print(front)
else:
    print(back)
import numpy as np
x,n=map(int,input().split())
arr=np.array(list(map(int,input().split())))
i=0
while (x+i in arr) and (x-i in arr):
  if not(x-i-1 in arr):
    print(x-i-1)
    exit()
  elif not(x+i+1 in arr):
    print(x+i+1)
    exit()
  i+=1
x,n = list(map(int,input().split()))
if n == 0:
  print(x)
  exit()

p = list(map(int,input().split()))
p = [-1] + p + [101]
import bisect
p.sort()
i = bisect.bisect_left(p,x)
if p[i] != x:
    print(x)
    exit()

for h in range(102):
  if p[i-h] != x-h:
    print(x-h)
    exit()
  elif p[i+h] != x+h:
    print(x+h)
    exit()
X, N = map(int, input().split())

if N==0:
  print(X)
  exit(0)
  
p = [int(i) for i in input().split()]

for i in range(X):
  for s in [-1,1]:
    a = X + i*s
    if a not in p:
      print(a)
      exit(0)
X, N = map(int, input().split())
p = list(map(int, input().split()))
pp = set(p)

ans = 10000
idx = 0
for i in range(1, 101):
    if(abs(X-i) < ans):
        if(i not in pp):
            ans = abs(X-i)
            idx = i
if(X < ans):
    idx = 0 
print(idx)
x,n=map(int,input().split())
import sys

if n>=1:
    p=list(map(int,input().split()))
else:
    print(x)
    sys.exit()
s=[]
d={}
l={}
for i in range(-101,101):
    if i not in p:
        s.append(i)


for k in s:

    d[k]=abs(x-k)


l=[m[0] for m in d.items() if m[1]==min(d.values())]
print(min(l))
x, n = map(int, input().split())
if n != 0:
  l = list(map(int, input().split()))

ze = [0 for i in range(101)]

for i in range(n):
  ze[abs(x-l[i])] += 1
  
if ze[0] == 0:
  print(x)
else:
  for i in range(1, 101):
    if ze[i] != 2:
      if x+i not in l:
        print(x+i)
        break
      else:
        print(x-i)
        break
x, n = list(map(int, input().split()))

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

upper_ans = x

for i in range(x, 101):
    if not (i in ps):
        upper_ans = i
        break

lower_ans = x

for j in reversed(range(0, x + 1)):
    if not (j in ps):
        lower_ans = j
        break

if lower_ans == 0:
    ans = 0
elif abs(x - upper_ans) < abs(x - lower_ans):
    ans = upper_ans
elif abs(x - upper_ans) > abs(x - lower_ans):
    ans = lower_ans
else:
    ans = min(upper_ans, lower_ans)

print(ans)
x,n=map(int,input().split())
r=[i-x for i in map(int,input().split())]
for i in range(1,n+1):
  if not -(i) in r:
    print(x-i)
    break
  elif not i in r:
    print(x+i)
    break
X, N = map(int, input().split())
P = [int(i) for i in input().split()]

check = [0 for i in range(100)]
for i in range(N):
    check[P[i]-1] = 1
    
dx = 1000
ans = -1
for i in range(100):
    if check[i] == 0:
        if abs(X-(i+1)) < dx:
            dx = abs(X-(i+1))
            ans = i + 1
            
print(ans)
#C
X, N = list(map(int, input().split()))
p = set(map(int, input().split()))

result = X
if p:
    if X not in p:
        result = X
    else:
        for i in range(1, len(p)):
            if X - i not in p:
                result = X - i
                break
            elif X + i not in p:
                result = X + i
                break
    print(result)
else:
    print(X)
x, n = map(int, input().split())
try:
    in_li = set(map(int, input().split()))
    num_li = list({i for i in range(0,101)} - in_li)
except:
    in_li = set()
    num_li = []

num_li.sort()
res = 0

if n == 0:
    print(x)
elif x not in in_li:
    print(x)
else:
    for i in num_li:
        if abs(x-i) < abs(x-res):
            res = i
    print(res)
x, n = map(int, input().split())
if n > 1:
  list = list(map(int, input().split()))
else:
  print(x)
  exit(0)
   
for i in range(101):
  if (x-i) not in list:
    print(x-i)
    break
  if (x+i) not in list:
    print(x+i)
    break
x,n = map(int,input().split())
p = list(map(int,input().split()))
if n==0:
    print(x)
    exit()
res = []
for num in range(-100,101):
    if x!=num and num not in p:
        res.append(abs(x-num))
if x-min(res) not in p and x-min(res)!=0:
    print(x-min(res))
elif x-min(res)==0:
    res.remove(min(res))
    if x-min(res) not in p:
        print(x-min(res))
    else:
        print(x+min(res))
else:
    print(x+min(res))
x,n = map(int,input().split())

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

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

ans = 0
for i in range(101):
    if i in a:
        continue
    if abs(x-ans) > abs(x-i):
        ans = i
        
if ans != 0:
    print(ans)
else:
    print(0 if x <= 50 else 100)
import sys

def Forbidden_List(x,n,p):
  for i in range(n//2 + n%2):
    if x - i not in p: 
        return x - i
    if x + i not in p:
        return x + i
  return x - n//2 - n%2

if __name__ == '__main__':
    input = sys.stdin.readline
    
    inp1 = input().rstrip().split()
    x,n = int(inp1[0]),int(inp1[1])
    if n == 0:
        print(x)
    else: 
        inp2 = input().rstrip().split()
        p = list(map(int,inp2))
        print(Forbidden_List(x,n,p))
x, n = map(int, input().split())
p = []
p = list(map(int, input().split()))
i = 0
j = 0
ans = 0
if(n == 0):
    print(x)
for i in range(n):
    X = x + ((-1) ** (i)) * int((i + 1) / 2)
    for j in range(n):
        if(X == p[j]):
            ans = 1
            break
        ans = 0
    if(ans == 0):
        print(X)
        break
X,N=map(int,input().split())
P=list(map(int,input().split()))
m=100
ans=0
lis=list(range(101,-1,-1))
for k in lis:
    for l in range(N):
        if k==P[l]:
            lis[100-k]=0
for i in lis:
    if abs(i-X)<=m:
        m=abs(i-X)
        ans=i
print(ans)
x, n = map(int, input().split())
ps = list(map(int, input().split()))
pss = [i for i in range(1,100+1)]
ps = list(set(pss)-set(ps))
ans = x

for i, p in enumerate(ps):
    temp = abs(x-p)
    if i == 0:
        mins = temp
        ans = p
    else:
        if mins > temp:
            mins = temp
            ans = p
print(ans)
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit(0)
else:
    p = [int(x) for x in input().split()]

p.sort()


ans1 = 100
ans2 = 100

flag = 1

for i in range(102):
    if x-i not in p:
        ans1 = x-i
        flag = 0
    if x+i not in p:
        ans2 = x+i
        flag = 0
    if flag == 0:
        break
    else:
        continue

print(min(ans1, ans2))
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n+1):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            ans = tmpx

print(ans)
x, n = 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
        print(ans)
        break
for i in range(100):
    if x + i not in l:
        ansb = x + i
        ab = i + 1
        print(ansb)
        break
if a > ab:
    print(ansb)
else:
    print(ans)
x,n = map(int, input().split())
p = list(map(int, input().split()))
ans = 101
num = 0
for i in range(101):
    if i not in p:
        if abs(x - i) < ans:
            ans = abs(x - i)
            num = i
print (num)
X,N = map(int,input().split())

if N == 0:
  print(X)
  exit();

p = [int(i) for i in input().split()]
  
q = set(range(101)) - set(p)  
  
r = sorted(q,key=lambda x:(abs(x-X),x))

print(r[0])
X, N = map(int, input().split())
p = list(map(int, input().split()))
a = [False for _ in range(1000)]
for P in p:
    a[P] = True

ans = -1
d = 10000
for i in range(1, 110):
    if d > abs(i - X) and a[i] == False:
        d = abs(i - X)
        ans = i

print(ans)
x,n = map(int,input().split())
plist = list(map(int,input().split()))
for j in range(x):
    if x-j not in plist:
        print(x-j)
        break
    if x+j not in plist:
        print(x+j)
        break
x, n = map(int, input().split())
p = list(map(int, input().split()))
flag = [False] * 101
for value in p:
    flag[value] = True
minAbs = 100
for i in range(101):
    ab = abs(x - i)
    if not flag[i]:
        minAbs = min(minAbs, ab)
for i in range(101):
    ab = abs(x - i)
    if not flag[i] and ab == minAbs:
        print(i)
        break
x,n=map(int,input().split())
nlist=list(map(int,input().split()))
Nlist=[]
if n==0:
    print(x)
    exit(0)
elif x not in nlist:
    print(x)
    exit(0)

delta=200
ans=-x
for i in range(-x,100):
    if i not in nlist:
        X=abs(x-i)
        if X<delta:
            ans=i
            delta=X
print(ans)
x,n =map(int,input().split())
if n ==0:
    print(x)
p =list(map(int,input().split()))
l = []
for i in range(51):
    if x-i not in p and x+i not in p:
        print(min(x-i,x+i))
        exit()
    elif x-i not in p and x+i in p:
        print(x-i)
        exit()
    elif x-i in p and x+i not in p:
        print(x+i)
        exit()
n,m=map(int,input().split())
a=list(map(int,input().split()))
if len(a)==0:
  print(n)
else:
  a.sort()
  if n not in a:
    print(n)
  else:
    cnt=0
    for i in range(n):
      if i in a:
        continue
      else:
        cnt=i
    print(cnt)
x,y=map(int,input().strip().split())
nums = list(map(int, input().strip().split()))
ans=0
if y==0:
  print(x)
elif x not in nums:
  print(x)
else:
  for i in range(0,101):
    if i not in nums:
      if abs(x-i)<abs(x-ans):
        ans=0
        ans+=i
  print(ans)
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit(0)
p = list(map(int, input().split()))
a = [i for i in range(101)]
b = sorted(list(set(a) - set(p)))
min_v = 1000
min_id = 0
for i in range(len(b)):
  if abs(x - b[i]) < min_v:
    min_v = abs(x - b[i])
    min_id = i
print(b[min_id])
X,N=map(int,input().split())
p=list(map(int,input().split()))
p_bar=[]
for i in range(0,101):
  if i not in p:
    p_bar.append(i)

d_min=1000
i_min = 0
for i in p_bar:
  d = abs(X-i)
  if d < d_min:
    d_min = d
    i_min = i
print(i_min)
x, n = map(int, input().split(' '))
min_num = 100

ls = [0] * 101
for i in range(0, 101):
    ls[i] = i

ls_in = [0] * n
if n > 0:
    ls_in = list(map(int, input().split(' ')))
    for i in ls_in:
        ls.remove(i)
    ls.reverse()
    for i in ls:
        min_num = min(abs(x-i), min_num)
        if abs(x-i) == min_num:
            ans = i 
    print(ans)
else:
    print(x)
X,N=map(int, input().split())
p=list(map(int, input().split()))

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

for i in range(N):
    if p.count(max(0,X-i))==0:
        print(X-i)
        exit()
    if p.count(X+i)==0:
        print(X+i)
        exit()
x,n = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if x > 101 - x:
    ans = 101
else:
    ans = 0
for i in range(1,101):
    if i in a:
        continue
    if abs(x-i) < abs(x-ans):
        ans = i
print(ans)
x,n = map(int,input().split())
q = []
saidai = 0
if n > 0:
  p = list(map(int,input().split()))
  if x > max(p):
    saidai = x
  else:
    saidai = max(p)
  for i in range(saidai):
    if i+1 not in p: 
      q.append(i+1)
  for i in range(len(q) - 1):
    if abs(x - q[i + 1]) >= abs(x - q[i]):
      print(q[i])
      break
    if i == len(q) - 2:
        print(q[i + 1])
else:
  print(x)
x,n = map(int,input().split())
if n == 0:
    input()
    print(x)
else:
    li = list(map(int,input().split()))
    for i in range(1, 101):
        up = x + i
        down = x - i
        if down not in li:
            print(down)
            break
        if up not in li:
            if down == up:
                print(down)
                break
            else:
                print(up)
                break
if __name__ == '__main__':
	x,n = map(int,input().split())
	p = [int(a) for a in input().split()]
	p.sort()
	if x in p:
		if p[0] > x:
			print(p[0])
		elif p[-1] < x:
			print(p[-1])
		else:
			m = 100
			ans = 0
			for i in range(p[0],p[-1]):
				if not i in p:
					v = abs(i-x)
					if m > v:
						m = v
						ans = i
			print(ans)
	else:
		print(x)
X,N=map(int,input().split())
P=list(map(int,input().split()))

minv=100
v=0
if P:
  for i in range(-100,101):
    if not(i in P):
      if abs(X-i) < minv:
        minv=abs(X-i)
        v=i
else:
  v=X

print(v)
a, b= map(int, input().split())
lista= [int (x) for x in input().split()]

for i in range(200):
    if a-i not in lista:
        print(a-1)
        exit()
    elif a+i not in lista:
        print(a+1)
        exit()
x,n = map(int,input().split())
p = input().split()
p.sort()
q = p[::-1]
a = x
b = x
for i in q:
  if a == int(i):
    a -= 1
for i in p:
  if b == int(i):
    b += 1 
if x - a <= b - x:
  print(a)
else:
  print(b)
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
b=sorted(b)
base = 1000
for i in range(-100, 101):
  if abs(a[0]-base)>abs(a[0]-i) and i not in b:
    base = i
print(base)
x, n = map(int, input().split())

if n == 0:  
    p = input()
    print(x)
else:
    p = list(map(int, input().split()))
    max_p = max(p)
    ans = 0
    tmp = 1000

    for i in range(1, 200):
        diff = abs(x - i)
        if i not in p and tmp > diff:
            ans = i
            tmp = diff

    print(ans)
X, Y = map(int, input().split())


def myfunc(X, Y):
    for tsuru in range(X+1):
        turtle = X - tsuru
        legs = turtle * 4 + tsuru * 2

        if legs == Y:
            return "Yes"

    return "No"

print(myfunc(X,Y))
import sys

(x, n) = map(int, sys.stdin.readline().strip().split())
list_input = list(map(int, input().split()))

if x not in list_input:
    print(x)
    exit()

for i in range(1, n):
    if x - i not in list_input:
        print(x-i)
        exit()
    elif x + i not in list_input:
        print(x+i)
        exit()
n = input().split()
X, LEN = list(map(int, n))

nn = input().split()
nums = list(map(int, nn))

# print(X, LEN, nums)

# 近似値の探索
pos = X
neg = X
result = X

while True:
    if (len(nums) <= 0):
        break

    pos += 1
    neg -= 1

    if (not neg in nums):
        result = neg
        break
    if (not pos in nums):
        result = pos
        break
print(result)
x,n=map(int,input().split())
p=set(map(int,input().split()))

s=set()
for i in range(101):
    s.add(i)

s=list(s-p)

a=[abs(x-i) for i in s]
print(s[a.index(min(a))])
X, N = map(int, input().split())
p = list(map(int, input().split()))
S = []

for i in range(101):
  if i in p:
    continue
  else:
    S.append(abs(i-X))

print(min(S))
import sys
def main():
    x, n = map(int, input().split())
    p = list(map(int,input().split()))
    
    if (n==0):
        print(x)
        sys.exit()

    for i in range(n):
        low = x - i
        if (low not in p):
            print(low)
            sys.exit()
            
        up = x + i
        if (up not in p):
            print(up)
            sys.exit()
    
main()
x,n = map(int,input().split())
ans = 0
if n == 0:
    print(x)
else:
    p = sorted(list(map(int,input().split())), reverse=True)
    data = []
    for i in range(100,0,-1):
        if not(i in p):
            data.append(i)
    #print(data)
    mi = 1000
    for i in data:
        #print(p)
        if mi >= abs(i-x):
            mi = abs(i-x)
            ans = i
    print(ans)
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
a=list(map(int,input().split()))
for i in range(n):
  if x-i not in a:
    print(x-i)
    exit()
  if x+i not in a:
    print(x+i)
    exit()
x,n=input().split()
x=int(x)
n=int(n)
p=list(map(int,input().split()))
if(n==0):
    print(x)
    exit()
i=1
while(True):
    x_r=x+i
    x_l=x-i

    if(x_l not in p):
        a=x_l
        break
    if(x_r not in p):
        a=x_r
        break

    i+=1


print(a)
X, N = map( int, input().split() )
if N > 0:
  P = sorted( list( map( int, input().split() ) ))
  ret = -1
  dis = 10 ** 18
  for i in range( 1, 100 + 1 ):
    if i in P:
      continue
    if dis - abs( i - X ) > 0:
      ret = i
      dis = abs( i - X )
else:
  ret = X
print( ret )
X,N=map(int, input().split())
if N==0:
  print(X)
  exit()
P=list(map(int, input().split()))  
ans=-1
for i in range(-1,101):
  if i not in P:
    if abs(X-i)<abs(X-ans):
      ans=i
print(ans)
import sys
X, N = 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(num+X)
x, n = map(int, input().split())
if(n == 0):
    print(x)
elif(n == 100):
    ff = 101-x
    gg = x
    if(ff < gg):
        print(101)
    else:
        print(0)
else:
    p = list(map(int, input().split()))
    m = [i for i in range(1, 101)]

    o = list(set(m) - set(p))
    ans = 1
    dif = x
    for i in range(len(o)):
        if(dif > abs(x-o[i])):
            ans = o[i]
            dif = abs(x-o[i])
    print(ans)
import numpy as np
X, N = map(int, input().split())
if N > 0:
  l1=list(map(int,input().split()))
else:
  l1=[]
ans = 100
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 = [int(x) for x in input().strip().split()]
p = [int(x) for x in input().strip().split()]
ans = 0
diff = X
for i in range(102):
  if abs(X - i) < diff:
    ans = i
print(ans)
x, n = map(int, input().split())
P = set(list(map(int, input().split())))
ans = 0
diff = x
for a in range(101):
    if a not in P:
        tmp = abs(a-x)
        if diff > tmp:
            diff = tmp
            ans = a
print(ans)
X,N = input().split()

import sys
X = int(X)
N = int(N)


if N ==0:
    print(X)
else:
      n = input().split()
      n = [int(s) for s in n]
      for i in range(1,N+1):
        if X -i not in n:
            print(X-i)
            break
        elif X + i not in n:
            print(X+i)
            break
x, n = map(int, input().split())
p = list(map(int, input().split()))
#for i in range(n):
#    p.append(input().split())
#print(p)
#rint(type(p[0]))
min = 1e9
ans = 0
for i in range(100):
    i = i + 1
    if i in p:
        continue
    sa = abs(x - i)
    #print(sa)
    if min > sa :
        min = sa
        ans = i
print(ans)
import sys

x, n = map(int, input().split())
p = list(map(int, input().split()))
list_p = [i for i in range(0, 102)] 
t = x
num = x

for i in p:
  list_p[i] = -1

for i in range(len(list_p)):
  if(list_p[i] == -1):
    continue
  else:
    if(abs(list_p[i] - x) < t):
      t = abs(list_p[i] - x)
      num = list_p[i]

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

p.sort()

arr = [False] * 101

for i in range(len(p)):
    arr[p[i]] = True

dist = 10*10

ans = -99

search = list(range(101))
search.reverse()

for i in search:
    if arr[i] == False:
        dist = min(abs(x - i), dist)
        if dist == abs(x - i):
            ans = i
print(ans)
X, N = map(int, input().split())
P = list(map(int, input().split()))


diff = 10000
best = -1
for i in range(1, 201):
    if i not in P:
        d = abs(X-i)
        if diff > d:
            best = i
            diff = d
            # print(i)
print(best)
kazulist = []
for i in range(100):
    kazulist.append(i+1)
 
a = list(input().split(" "))
target = int(a[0])
syokyo = int(a[1])

if syokyo != 0:
    b = list(input().split(" "))
    for i in b:
        kazulist.remove(int(i))

#print(kazulist)
 
saisyosa = 100
kotae = 0
for i in kazulist:
    sa = target - int(i)
    if sa < 0:
        sa *= -1
    if sa < saisyosa:
        saisyosa = sa
        kotae = i
 
print(kotae)
x, n = map(int, input().split())
if n != 0:
    l = list(map(int, input().split()))
else:
    l = []

diff = 10**10
ans = 10**10

for i in range(101):
    if i in l:
        continue
    else:
        if abs(x-i) < diff:
            ans = i
            diff = abs(x-i)

print(ans)
import sys
import math
import itertools
x, n = map(int, input().split())
p = list(map(int, input().split()))
if (n == 0):
    print(x)
    sys.exit()
diff = 1000
ans = 0
p.sort()
diff=1000
for i in range(100):
    if (i in p):
       continue
    else:
        if (abs(x - i) < diff):
            diff = abs(x - i)
            ans = i
print(ans)
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
p = list(map(int, input().split()))
numlist = [i for i in range(1, 101)]

absn = 100
ans = 1000

for i in numlist:
    if absn >= abs(X-i) and i not in p:
        if absn == abs(X-i):
            break
        else:
            ans = i
            absn = abs(X-i)

print(ans)
x, n = map(int, input().split())
if n > 1:
  list = list(map(int, input().split()))
else:
  print(x)
  exit(0)
   
for i in range(n+1):
  if (x-i) not in list:
    print(x-i)
    break
  if (x+i) not in list:
    print(x+i)
    break
import numpy as np
def forbidden_list():
    X, N = map(int,input().split())
    p = list(map(int, input().split()))
    lis = np.array([1 for i in range(101)])
    lis[p] = 0
    index = X
    ma = 101 - X
    for i in range(max(X,ma)):
        if index - i >= 0 and lis[index-i]:
            print(index-i)
            break
        elif index + i <= 100 and lis[index + i]:
            print(index + i)
            break
    
forbidden_list()
X, N = map(int, input().split())
A = [map(int, input().split())]
a = 0
while True:
  if X-a not in A:
      print(X-a)
      break
  if X+a not in A:
      print(X+a)
      break
  a += 1
#C
X, N = list(map(int, input().split()))
p = set(map(int, input().split()))

result = X
if p:
    if X not in p:
        result = X
    else:
        for i in range(1, len(p)):
            if X + i not in p:
                result = X + i
                break
            elif X - i not in p:
                result = X - i
                break
    print(result)
else:
    print(X)
x, n = list(map(int, input().split()))
q = list(map(int, input().split()))
p = [i for i in range(1, 102) if i not in q]

for i in range(len(p)):
    if p[i] < x:
        continue
    # p[i] >= x
    break

if p[i] == x:
    print(p[i])
else:
    if p[i] - x < x - p[i - 1]:
        print(p[i])
    else:
        print(p[i - 1])
X,N=map(int, input().split())
p=list(map(int, input().split()))

a = 100
num = 0

for i in range(101):
    if i not in p:
        b = i-X
        if abs(b) < a:
            a = abs(b)
            num = i

print(num)
#C
x,n = map(int,input().split())
p = list(map(int,input().split()))
tmp = 1000
a = [i for i in range(1,101)]
b = [-i for i in range(0,100)]

a = a+b
result = []
p_dif = set(a) - set(p)
#print(p_dif)

for i in p_dif:
    if tmp > abs(i-x):
        tmp = abs(i-x)
        result = i
        
        
print(result)
import numpy as np
X,N = map(int, input().split())
if N != 0:
  p = list(map(int, input().split()))
  min_val = 0
  max_val = 101
  not_p = [i for i in range(min_val,max_val+1,1)]
  
  for i in range(N):
    not_p.remove(p[i])
  print(not_p)

  min_val = 999
  out_num = 101
  for i in range(len(not_p)):
    if abs(X-not_p[i]) < min_val:
      min_val = abs(X-not_p[i])
      out_num = not_p[i]
  print(out_num)
else:
  out_num = 0
target, N = [int(x) for x in input().split(" ")]
if N == 0:
    print(target)
else:
    p_array = [int(x) for x in input().split(" ")]

    for i in range(N):
        superior = target - i - 1
        if not(superior in p_array):
            print(superior)
            break

        inferior = target + i + 1
        if not(inferior in p_array):
            print(inferior)
            break
X, N = input().split()
X = int(X)
N = int(N)
p = list(map(int, input().split()))

tmp = [i for i in range(-100, 101)]
for i in p:
  tmp.remove(i)
for i in range(len(tmp)):
  tmp[i] = abs(tmp[i] - X)

ans = 0
for i in p:
  if X-min(tmp)==i:
    ans = 1

if ans==0:
  print(X-min(tmp))
else:
  print(X+min(tmp))