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

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



P_n = [i for i in range(110) if i not in P]

abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]



import sys



min_abs = min(abs_value)

for k in range(len(abs_value)):

    if abs_value[k] == min_abs:

        print((P_n[k]))

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

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





P_n = [i for i in range(110) if i not in P]

abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]





min_abs = min(abs_value)

for k in range(len(abs_value)):

    if abs_value[k] == min_abs:

        print((P_n[k]))

        break
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
P_n = [i for i in range(110) if i not in P]
abs_value = [abs(X - P_n[j]) for j in range(len(P_n))]
import sys

min_abs = min(abs_value)
for k in range(len(abs_value)):
    if abs_value[k] == min_abs:
        print((P_n[k]))
        sys.exit()

X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
P_n = [i for i in range(110) if i not in P]
abs_value = [abs(X - P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)
for k in range(len(abs_value)):
    if abs_value[k] == min_abs:
        print((P_n[k]))
        break

-import sys - -        sys.exit() +        break