peterverebics/CodeNet_Python_118 huggingface dataset:
x ,y = map(int, input().split())

correct = False

for i in range(1,x):
    for j in range(1,x):
        if i * 4 + ((j - i) * 2) == y:
            correct = True
            break
        else:
            correct = False

if correct == True:
    print ("Yes")
else:
    print ("No")
X, Y = map(int, input().split())

result = 'No'
temp = 0
for _ in range(X * 2):
    temp += 2
    if temp == Y:
        result = 'Yes'
        break

print(result)
X, Y = list(map(int, input().split()))
print('Yes' if Y - X * 2 <= X * 2 else 'No')
A, B = map(int, input().split())
turu = 2 * A - B // 2
kame = B // 2 - A
if (turu > 0) and (kame > 0):
    print('Yes')
else:
    print('No')
x, y = [int(x) for x in input().split()]
canbe = "No"
for i in range(1, x + 1):
  if (i * 2) + (x - i) * 4 == y:
    canbe = "Yes"
    break
print(canbe)
x,y=map(int,input().split())
l=[]
for i in range(x):
  l.append(2*(x+i))
  i+=1
print('Yes' if y in l else 'No')
A = list(map(int, input().split()))
if A[1]/2 == A[0]:
    print("Yes")
elif A[1]/4 == A[0]:
    print("Yes")
else:
    print("No")
X, Y = map(int, input().split())

for a in range(X + 1):
    for b in range(X + 1):
        if a * 2 + b * 4 == Y:
            print('Yes')
            exit()
print('No')
#!/usr/bin/env python3
x, y = map(int, input().split())

if x == 1:
    if (y == 2) or (y == 4):
        print("Yes")
    else:
        print("No")
else:
    ans = (4 * x - y) / 2

    if ans == 0:
        print("Yes")
    if not (ans.is_integer):
        print("No")   
    if ans <= x and ans >= 1:
        print("Yes")
    else:
        print("No")
x,y=map(int,input().split())
print("Yes" if (y-x*2)/2 <=x else "No")
x, y = map(int, input().split())

turu = (4*x-y)//2
# print(turu)

if (turu < 0):
    print("No")
    exit()

if ((y-turu*2) % 4 == 0):
    print("Yes")
else:
    print("No")
x,y = map(int,input().split())
if (y - 4 * x) % 2 ==1:
    print("No")
elif (y - 4 * x) // 2 <x:
    print("Yes")
else:
    print("No")
x, y = map(int, input().split())
for a in range(1, x + 1):
    if 2 * a + 4 * (x - a) == y:
        print('Yes')
        exit()
print('No')
x,y=(map(int,input().split()))
s=(4*x-y)/2.0
if s > 0 and (s*10%10==0):
    print("YES")
else:
    print("NO")
arr = list(map(int, input().split()))


hiki = arr[0]
foot = arr[1]


if foot%2==1:
    print("No")
elif hiki*4<foot:
    print("No")
elif hiki*2>foot:
    print("No")
else:
    for turu in range(1,hiki+1):
        if((foot - turu*2)/4==hiki-turu):
            print("Yes")
            break;
x, y = map(int, input().split())

a = y / 2
b = 0
while (a + b) != x:
  a -= 2
  b += 1
  if a == -1:
    a = 0
  elif a < -1:
    break

s = 2 * a + 4 * b
if s == y and a >= 0:
  print("yes")
else:
  print("no")
x,y = map(int,input().split())
for i in range(1,x+1):
    num_tur = i
    num_tsu = x - i
    if num_tsu * 4 + num_tur * 2 == y:
        print("Yes")
        exit()
print("No")
X,Y=list(map(int,input().split()))
judge=False
for i in range(1,X+1):
  if i*2+(X-i)*4==Y:
    judge=True
if judge:
  print("Yes")
else:
  print("No")
A_B = list(map(int, input().split()))
X = A_B[1] / 2 - A_B[0]
if X <= 0:
    print("No")
elif (X - int(X)) < 0:
    print("No")
elif X > A_B[0]:
    print("No")
else:
    print("Yes")
X, Y = map(int, input().split())
ans = ''
for i in range(1, X+1):
	if (i*2 + (X-i)*4) == Y:
		ans = 'Yes'
		break
	else:
		ans = 'No'
print(ans)
x, y = list(map(int,input().split()))
ans = y / 2 - x 
if ans >= x:
    print("No")
elif ans <= x:
    print("Yes")
else:
    print("No")
#-*- coding -*-
a,b = map(int, input().split())
f = False
for i in range(a):
  if i * 2 + (a - i) * 4 == b:
    f = True
    
if f:
  print("Yes")
else:
  print("No")
a,b = map(int,input().split())
for i in range(a+1):
  for j in range(a+1):
      if 2*i+4*j == b:
        print("Yes")
        exit()
print("No")
X, Y = map(int, input().split())
A = X
B = 0
if Y % 2 != 0:
  print("NO")
else:
  while A >= 0:
    C = A*2 + B*4
    if C == Y:
      print("YES")
      A-=1
      B+=1
  print("NO")
X,Y = map(int,input().split())
v = Y-(2*X)
if v<0 or v%2==1:
  print('No')
elif 4*X > Y:
  print('No')
else:
  print('Yes')
x,y=map(int,input().split())

for i in range(x+1):
  for j in range(x+1-i):
    if 2*i+4*j==y:
      print("Yes")
      exit(0)
print("No")
import bisect
def main():
  X, N = map(int, input().split())
  if N == 0:
    print(X)
    return
  P = set(map(int, input().split()))

  NP = sorted(list(set(range(102)) - P))
  right = bisect.bisect(NP, X)
  left = right - 1
  if left == -1 or abs(X - NP[left]) > abs(X - NP[right]):
    print(NP[right])
  else:
    print(NP[left])

main()
x, n = 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
x, n = map(int, input().split())
p = list(map(int, input().split()))

for i in range(100):
    if not p.count(x-i):
        print(x-i)
        exit()
    elif not p.count(x+i):
        print(x+i)
        exit()
import sys

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

t = True
i,j=0,0

if x not in p:
    print(x)
    sys.exit()

i,j=1,1

while t:
    ans = x+i*(-1)**j
    if ans in p:
        if j == 2:
            j = 1
            i += 1
        else:
            j += 1    
    else:
        t = False

print(ans)
import numpy as np
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    l = list(map(int, input().split()))
    app = [x for x in range(X - int(N / 2) - 1, X + int(N / 2) + 1) if x not in l]
    print(app[np.argmin([abs(x - X) for x in app])])
X, N = map(int, input().split())
try:
    P = set((map(int, input().split())))
except:
    print(X)
    exit()
dif = 0
while X - dif in P:
    if not X + dif in P:
            print(X + dif)
            exit()
    dif += 1
print(X - dif)
x,n=map(int,input().split())

import sys
if n==0:
    print(x)
    sys.exit()
p=list(map(int,input().split()))
if x not in p:
    print(x)
    sys.exit()
min=x
max=x

while True:
    min-=1
    max+=1
    if min not in p:
        ans=min
        break
    if max not in p:
        ans=max
        break
print(ans)
import bisect
x, n = map(int, input().split())
pN = list(map(int, input().split()))

pN.sort()

diff = 0

if n == 0:
    print(x)
else:
    while(1):
        if x-diff not in pN:
            print(x-diff)
            exit()
        elif x+diff not in pN:
            print(x+diff)
            exit()
        diff+=1
x,N = list(map(int,input().split(" ")))
if N != 0:
  p = list(map(int,input().split(" ")))
  sa = 0
  ans = -100
else:
  ans = x

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

l=list(range(102))

for i in range(n):
  l.remove(p[i])

#print(l)
ans=0
dif=1000

for i in range(102-n):
  temp=abs(l[i]-x)
  if temp<dif:
    dif=temp
    ans=l[i]
print(ans)
X,N = map(int,input().split())

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

P = [int(i) for i in input().split()]
mn = 1000
for i in reversed(range(102)):
	if i in P:
		continue
	if mn >= abs(X-i):
		ans = i
		mn = min(mn,abs(X-i))

print(ans)
X, N = map(int, input().split())
P = list(map(int, input().split()))
ans, mind = -1, 200
for i in range(102):
    if mind > abs(i - X) and i not in P:
        mind = abs(i - X)
        ans = i
print(ans)
x,n = map(int,input().split())
if n == 0:
  print(x)
  exit()
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
from sys import stdin
X, N = [int(x) for x in stdin.readline().rstrip().split()]
p = [int(x) for x in stdin.readline().rstrip().split()]

ans = 10000
ans_diff = 10000

list_100 = [0] * 100
for i in range(100):
  list_100[i] = i+1
  
list_100.append(0)
list_100.append(-1)
list_100.append(101)
  
live_list = list(set(list_100) - set(p))

for i in live_list:
  diff = abs(X - i)
  if diff < ans_diff:
    ans = i
    ans_diff = diff
  if diff == ans_diff:
    ans = min(ans, i)
 
print(ans)
x, n = map(int, input().split())
num_list = list(map(int, input().split()))
dif = 100000
o_list = []

if len(num_list) == 0:
    print(x)
    exit()
#
# for i in range(1, max(num_list)):
#     if i not in num_list:
#         o_list.append(i)

for i in range(-1000, 1000):
    if i not in num_list:
        o_list.append(i)

o_list.sort(reverse=True)

for num in o_list:
    if abs(x - num) <= dif:
        # if x not in num_list:
        dif = abs(x -num)
        ans = num

print(ans)
x, n = map(int, input().split(" "))
p = input()
if p == "":
    print(x)
    exit(0)
p = list(map(int, p.split(" ")))
answer = 0
for i in range(1, 102):
    if i not in p:
        if abs(x - answer) > abs(i - x):
            answer = i
print(answer)
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    X,N = map(int,input().split())
    P = set(map(int,input().split()))
    ans = -1
    M = INF
    for i in range(X - 105,X + 105):
        if i not in P:
            if M > abs(i - X):
                ans = i
                M = abs(i - X)
    print(ans)
if __name__ == '__main__':
    main()
X,N = map(int,input().split())
p = sorted(list(map(int,input().split())))
for i in range(X,-1,-1):
    if i not in p:
        ans = i
        break
for i in range(X+1,102):
    if i not in p:
        ans2 = i
        break
if X-ans > ans2-X:
    print(ans2)
else:
    print(ans)
import math 
X, N = map(int,input().split())
d = int(999)
d1 = int()
ans = int(999)
if 0 < N:
    P = list(map(int,input().split()))
    for i in range(999):
        if P.count(i) == 0:
            d1 = abs(X-i)
            if d1 < d and 0 <= d1:
                d = d1
                ans = i
    print(ans)
else:
    print(X)
import math

X, N = map(int, input().split())
if N == 0:
  print(X)
else:
  p = list(map(int, input().split()))
  q = [int(i)-10 for i in range(121)]
  #print(q)

  for i in p:
    q.remove(i)

  ans = 0
  r0 = 100000
  for j in q:
    r = abs(j-X)
    if r0 > r:
      r0 = r
      ans = j
  print(ans)
X,N=map(int,input().split())
p=list(map(int,input().split()))

ans=0
for i in range(100):
  if X-i not in p:
    ans=X-i
    break
  elif X+i not in p:
    ans=X+i
    break

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

ans = x
if ans in lst:
    pass
else:
    print(ans)
    exit()

left,right = ans-1,ans+1

while True:
    if left in lst and right in lst:
        left -=1
        right += 1

    elif left in lst:
        print(right)
        exit()

    else:
        print(left)
        exit()
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = sorted([-999] + list(map(int, input().split())) + [999])

from bisect import bisect_left, bisect_right

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

# 小さい方
m = p.index(x) - 1
target_L = x - 1
while True:
    if target_L not in p:
        break
    target_L -= 1

target_R = x + 1
while True:
    if target_R not in p:
        break
    target_R += 1

if abs(target_L - x) <= abs(target_R - x):
    print(target_L)
else:
    print(target_R)
x,n=map(int,input().split())
p=set([int(j)for j in input().split()])
for i in range(1000):
    if x-i not in p:
        print(x-i)
        exit()
    if x+i not in p:
        print(x+i)
        exit()
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)
x,n=map(int,input().split())
p=list(map(int,input().split()))
ans=0
num=0
while ans==0:
    if (x+num) not in p:
        ans=x+num
    if (x-num) not in p:
        ans=x-num
        if ans==0:
            break
    num+=1
print(ans)
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans1, ans2 = x, x
cnt1, cnt2 = 0, 0
while ans1 in p:
    ans1 += 1
    cnt1 += 1
while ans2 in p:
    ans2 -= 1
    cnt2 += 1
if cnt1 >= cnt2:
    print(ans2)
else:
    print(ans1)
x,y=map(int,input().split())
if y==0:print(x);exit()
l=list(map(int,input().split()))
work=x
if not work in l:
    print(work)
    exit()
i=1
while 1:
    if not work-i in l:
        print(work-i)
        exit()
    if not work+i in l:
        print(work+i)
        exit()
    i+=1
X, N = map(int,input().split())
P = set(map(int,input().split()))
tmp = 101
for i in range(-100,110):
    if i in P:
        continue
    elif tmp > abs(X-i):
        tmp = abs(X-i)
        ans = i
print(ans)
x, n = map(int, input().split())

if n != 0:
    ps = list(map(int, input().split()))

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

score = 1000
answer = -1
for i in range(-1, 102):
    if i in p:
        continue
    if abs(X - i) < score:
        score = abs(X - i)
        answer = i
print(answer)
def main():
    X, N = list(map(int, input().split(' ')))
    if N == 0:
        P = input()
        print(X)
        return
    P = list(map(int, input().split(' ')))
    min_dist, ans = abs(X), 0
    for n in range(102):
        if n in P:
            continue
        if abs(X - n) < min_dist:
            min_dist = abs(X - n)
            ans = n
    print(ans)


if __name__ == '__main__':
    main()
able = list()
for i in range(103):
    able.insert(i, i-1)

X,N = map(int,input().split())
p = list(map(int,input().split()))
for i in range(len(p)):
    able.remove(p[i])

target = 1000
ans = 1000
for i in range(len(able)):
    
    if (target > abs(X - able[i])):
        # if (target == abs(X - able[i])): 
        #     ans = min(target, able[i])
        # else:
        target = abs(X - able[i])
        ans = able[i]
    
    # print(able[i], abs(X - able[i]), ans)

print(ans)
def main():
	x, n = map(int, input().split())
	P = list(map(int, input().split()))
	if n == 0:
		print(x)
		return
	ans = 0
	min_dis = 1000
	for item in range(102):
		if item in P:
			continue
		dis = abs(item - x)
		if min_dis > dis:
			min_dis = dis
			ans = item
	print(ans)
	return

if __name__ == "__main__":
	main()
x ,n= list(map(int, input().split()))
if n == 0:
    p = input()
    print(x)
else:
    p = list(map(int, input().split()))
    d = 0
    answer = 0
    while True:
        if x-d not in p:
            answer = x-d
            break
        elif x+d not in p:
            answer = x+d
            break
        d += 1
    print(answer)
import sys

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

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())
r=[i-x for i in map(int,input().split())]
for i in range(n+1):
  if not -(i) in r:
    print(x-i)
    break
  elif not i in r:
    print(x+i)
    break
line = input()
line = line.rstrip().split(' ')

x = int(line[0])
n = int(line[1])

line = input()
line = line.rstrip().split(' ')

p = []

for i in range(n):
    p.append(int(line[i]))
p.sort()

if  n == 0:
    print(x)
else:
    min = p[0] - 1
    max = p[-1] + 1
    answer = 1000
    for i in range(min, max + 1):
        if i in p:
            continue
        if abs(x - i) < abs(x - answer):
            answer = i

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

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

for i in range(100):
    if (x - i) not in plist:
        print(x - i)
        exit()
    if (x + i) not in plist:
        print(x + i)
        exit()
x,n=map(int,input().split())
p=list(map(int,input().split()))
q=list(range(-1,200))
for i in range(n):
    q.remove(p[i])
ans=-100
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)
X, N = map(int, input().split())
S = list(map(int, input().split()))

ans = X
for i in range(200):
    if X-i not in S:
        print(X-i)
        break
    elif X+i not in S:
        print(X+i)
        break
x, n = map(int, input().split())

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

else:
    p = list(map(int, input().split()))
    li = [i for i in range(-101, 102) if i not in p]
    li.sort(reverse = True)

    tmp1 = float('inf')
    ans = float('inf')

    for i in li:
        if abs(i - x) <= tmp1:
            if i < ans:
                ans = i
                tmp1 = abs(i - x)

    print(ans)
# coding: utf-8

############################

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

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

z=101
p_list = list(map(int,input().split()))
pp_list = [i for i in range(102)]

for j in p_list:
    pp_list.remove(j)

for k in pp_list:
    zettaiti = abs(x-k)

    if z > zettaiti:
        z = zettaiti
        ans = k

print(ans)
X, N = map(int, input().split())
if N == 0:
  print(X)
  exit()
p = list(map(int, input().split()))
numlist = []

for i in range(102):
  if not i in p:
    numlist.append(i)
m = 500
for j in numlist:
  sa = abs(X-j)
  if sa < m:
    m = sa
    num = j

print(num)
x,n = map(int,input().split())
if n == 0:
  print(x)
  exit()
a = list(map(int,input().split()))
b = [0 for _ in range(-300,301)]
for y in a:
  b[y+300] = 1
c = []
for i in range(601):
  j = i - 300
  if b[i] == 0:
    c.append([abs(x-j),j])
print(min(c)[1])
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
integer = [i for i in range(102)]
for i in range(N):
   integer.remove(p[i])
l = len(integer)
ans = -200
for i in range(l):
   if abs(ans) > abs(integer[i]-X):
      ans = integer[i] - X
print(ans + X)
X, N = map(int, input().split())
P = list(map(int, input().split()))

best = float('inf')
ans = -1
for a in range(102):
    if a in P:
        continue
    if best > abs(X - a):
        best = abs(X - a)
        ans = a
print(ans)
X, N = map(int, input().split())
P = list(map(int, input().split()))

min_val = -1
for i in range(-1000, 1000):
    if i in P:
        continue
    if abs(min_val - X) > abs(X - i):
        min_val = i
if len(P) == 0:
    print(X)
else:
    print(min_val)
if __name__ == '__main__':
	x,n = map(int,input().split())
	p = [int(a) for a in input().split()]
	p.sort()
	if x in p:
		m = 100
		ans = 0
		for i in range(-10,200):
			if not i in p:
				v = abs(i-x)
				if m > v:
					m = v
					ans = i
		print(ans)
	else:
		print(x)
XN = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
tmp=100
tmp_i=0
for i in range(102):
  if not i in p:
    if abs(XN[0]-i)<tmp:
      tmp=abs(XN[0]-i)
      tmp_i=i
print(tmp_i)

"""
10 5
4 7 10 6 5
"""
X, N = list(map(int, input().split()))

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

P = list(map(int, input().split()))
up_min = 0
low_min = 0

arr = [0] * 102
for i in P:
  arr[i] = 1
lower = arr[:X]
lower.reverse()
upper = arr[X:]
for i, num in enumerate(lower):
  if num == 0:
    low_min = len(lower) - 1 - i
    break
for i, num in enumerate(upper):
  if num == 0:
    up_min = len(lower) + i
    break

if abs(up_min - X) >= abs(X - low_min):
  print(low_min)
else:
  print(up_min)
X, N = map(int, input().split())
P = sorted(list(map(int, input().split())))
ans = -1
diff = 100000
for i in range(-10,110):
    if i in P: continue
    if diff > abs(i-X):
        diff = abs(i-X)
        ans = i
print(ans)
x,n,*p = map(int,open(0).read().split())
a = [[i,abs(x-i)] for i in range(0,102) if i not in p ]
a.sort(key=lambda x:x[1]) 
print(a[0][0])
def solve(x, n, nums):
	if not nums or x not in nums:
		return x
	a = x - 1
	b = x + 1
	while True:
		if a not in nums:
			return a
		if b not in nums:
			return b
		a -= 1
		b += 1

x, n = map(int, input().split())
A = None
if n > 0:
	A = set(list(map(int, input().split())))
print(solve(x, n, A))
x, n = map(int, input().split())
s = list(map(int, input().split()))
for j in range(n):
    s[j] = s[j] - x

i = 0
while True:
    if -i not in s:
        print(x-i)
        exit()
    if i not in s:
        print(x+i)
        exit()
    i += 1
x,n=map(int,input().split())
a=list(map(int,input().split()))
if n==0:
  ans=x
else:
  ans=0
  for i in range(101):
    y=x-i
    if y not in a:
      ans=y
      break
    z=x+i
    if z not in a:
      ans=z
      break
print(ans)
X, N = map(int, input().split())
if N == 0:
  print(X)
  exit()
p = list(map(int, input().split()))
ans = -float('inf')
d = float('inf')
for i in range(-10, 2100):
  if i not in p:
    if abs(X-i) < d:
      d = abs(X-i)
      ans = i

print(ans)
X, N = list(map(int, input().split()))
if N!=0:
    P = set(list(map(int, input().split())))
else:
    print(X)
    exit(0)

dist = 100
r = None
for i in range(105, -1, -1):
    if not i in P and abs(X-i) <= dist:
        dist = abs(X-i)
        r = i

print(r)
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p = [int(i) for i in input().split()]
    q = [x]
    for i in range(200):
        q.append(x - 1 - i)
        q.append(x + 1 + i)
    for i in q:
        if i not in p:
            print(i)
            break
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p = [int(_) for _ in input().split()]
    for i in range(100):
        if x-i not in p:
            print(x-i)
            break
        if x+i not in p:
            print(x+i)
            break
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,102):
    if i not in nums:
      if abs(x-i)<abs(x-ans):
        ans=i
  print(ans)
x, n = map(int, input().split())
banned = set()
if n:
    banned |= set(map(int, input().split()))
l = x
r = x
while l in banned and r in banned:
    l -= 1
    r += 1

if l not in banned:
    print(l)
elif r not in banned:
    print(r)
X,N = map(int,input().split())
if N>0:
    p_set = set(map(int,input().split()))
else:
    p_set = set()
min_dist_xp = 1000
for p in reversed(range(0,102)):
    if p not in p_set:
        dist_xp = abs(X-p)
        if dist_xp<=min_dist_xp:
            min_dist_xp = dist_xp
            ans = p
print(ans)
from collections import defaultdict
if __name__ == "__main__":
    x,n = map(int,input().split())
    l = list(map(int,input().split()))
    if n == 0 :
        print(x)
    else :
        l.sort()
        count = 0
        dist = 999
        ans = -100
        for i in range(-100,201) :
            if i in l :
                continue
            if dist > abs(x - i) :
                dist = abs(x - i)
                ans = i 
        print(ans)
X, N = list(map(int, input().split()))
if N == 0: print(X)
else:
    p = list(map(int, input().split()))
    if not X in p:
        print(X)
    else:
        q = [X-1, X+1]

        while True:

            if not q[0] in p:
                print(q[0])
                break
            elif not q[1] in p:
                print(q[1])
                break
            q = [q[0]-1, q[1]+1]
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
pN = [i for i in range(102) if i not in p]
pNm = [abs(i - x) for i in pN]
pmin = min(pNm)
print(pN[pNm.index(pmin)])
X, N = (int(i) for i in input().split())  
p = list(int(i) for i in input().split())  
cnt = 1000
res = 0
for i in range(110):
  if i in p :
    cnt = cnt
  else:
    if abs(X-i) < cnt :
      cnt = abs(X-i)
      res  = i
print(res)