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

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



if not X in p:

    print(X)

else:

    for i in range(1, 101):

        if not X - i in p:

            print((X - i))

            exit()

        elif not X + i in p:

            print((X + i))

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

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



if X not in p:

    print(X)

else:

    for i in range(1, 101):

        if X - i not in p:

            print((X - i))

            exit()

        elif X + i not in p:

            print((X + i))

            exit()

X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if not X in p:
    print(X)
else:
    for i in range(1, 101):
        if not X - i in p:
            print((X - i))
            exit()
        elif not X + i in p:
            print((X + i))
            exit()

X, N = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
if X not in p:
    print(X)
else:
    for i in range(1, 101):
        if X - i not in p:
            print((X - i))
            exit()
        elif X + i not in p:
            print((X + i))
            exit()

-if not X in p: +if X not in p: -        if not X - i in p: +        if X - i not in p: -        elif not X + i in p: +        elif X + i not in p: