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

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



if N == 0: 

   print(X)

else:

   for i in range(0,100):

       if not X-i in p_list:

           print((X-i))

           break

       elif not X+i in p_list:

           print((X+i))

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

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

if N==0:

    print(X)

else:

    for k in range(0,51):

        if not X-k in p:

            print((X-k))

            break 

        elif not X+k in p:

            print((X+k))

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

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

-p_list = list(map(int, input().split())) +p = list(map(int, input().split())) -    for i in range(0, 100): -        if not X - i in p_list: -            print((X - i)) +    for k in range(0, 51): +        if not X - k in p: +            print((X - k)) -        elif not X + i in p_list: -            print((X + i)) +        elif not X + k in p: +            print((X + k))