import numpy as np



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

if n == 0:

    print(x)

    exit()



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

for i in range(100):

    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()))

if n == 0:

    print(x)

    exit()



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

for i in range(100):

    if not x-i in p:

        print((x-i))

        exit()

    elif not x+i in p:

        print((x+i))

        exit()

import numpy as np

x, n = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
p = np.array(list(map(int, input().split())))
for i in range(100):
    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()))
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
for i in range(100):
    if not x - i in p:
        print((x - i))
        exit()
    elif not x + i in p:
        print((x + i))
        exit()

-import numpy as np - -p = np.array(list(map(int, input().split()))) +p = list(map(int, input().split()))