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

if N == 0:

    print(X)

else:

    ls = list(map(int, input().split(' ')))

    diff = -1

    for i in range(101, -1, -1):

        if i not in ls:

            if diff == -1:

                diff = abs(i - X)

                result = i

            else:

                diff = min(diff, abs(i - X))

                if diff == abs(i - X):

                    result = i

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

if N == 0:

    print(X)

else:

    ls = list(map(int, input().split(' ')))

    diff, rst = -1, 0

    for i in range(101, -1, -1):

        if i not in ls:

            if diff == -1:

                diff = abs(X - i)

                rst = i

            else:

                diff = min(diff, abs(X - i))

                if diff == abs(X - i):

                    rst = i

    print(rst)
X, N = list(map(int, input().split(" ")))
if N == 0:
    print(X)
else:
    ls = list(map(int, input().split(" ")))
    diff = -1
    for i in range(101, -1, -1):
        if i not in ls:
            if diff == -1:
                diff = abs(i - X)
                result = i
            else:
                diff = min(diff, abs(i - X))
                if diff == abs(i - X):
                    result = i
    print(result)

X, N = list(map(int, input().split(" ")))
if N == 0:
    print(X)
else:
    ls = list(map(int, input().split(" ")))
    diff, rst = -1, 0
    for i in range(101, -1, -1):
        if i not in ls:
            if diff == -1:
                diff = abs(X - i)
                rst = i
            else:
                diff = min(diff, abs(X - i))
                if diff == abs(X - i):
                    rst = i
    print(rst)

-    diff = -1 +    diff, rst = -1, 0 -                diff = abs(i - X) -                result = i +                diff = abs(X - i) +                rst = i -                diff = min(diff, abs(i - X)) -                if diff == abs(i - X): -                    result = i -    print(result) +                diff = min(diff, abs(X - i)) +                if diff == abs(X - i): +                    rst = i +    print(rst)