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

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



for i in range(101):

    if (x-i) not in num_list:

        print((x-i))

        exit()



    if (x+i) not in num_list:

        print((x+i))

        exit()

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

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



for i in range(100):

    if (x-i) not in num_list:

        print((x-i))

        exit()



    if (x+i) not in num_list:

        print((x+i))

        exit()

x, n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(101):
    if (x - i) not in num_list:
        print((x - i))
        exit()
    if (x + i) not in num_list:
        print((x + i))
        exit()

x, n = list(map(int, input().split()))
num_list = list(map(int, input().split()))
for i in range(100):
    if (x - i) not in num_list:
        print((x - i))
        exit()
    if (x + i) not in num_list:
        print((x + i))
        exit()

-for i in range(101): +for i in range(100):