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

diff = x

result = 0



if n != 0:

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

    ls_remaind = []

    for i in range(1, 102):

        if i not in ls:

            ls_remaind.append(i)

    for j in ls_remaind:

        if abs(x-j) == diff:

            result = min(result, j)

        elif abs(x-j) < diff:

            diff = abs(x-j)

            result = j

else:

    result = x



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

if N == 0:

    print(X)

else:

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

    P_ls.sort(reverse=True)

    diff = -1

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

        if i not in P_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(" ")))
diff = x
result = 0
if n != 0:
    ls = list(map(int, input().split(" ")))
    ls_remaind = []
    for i in range(1, 102):
        if i not in ls:
            ls_remaind.append(i)
    for j in ls_remaind:
        if abs(x - j) == diff:
            result = min(result, j)
        elif abs(x - j) < diff:
            diff = abs(x - j)
            result = j
else:
    result = x
print(result)

X, N = list(map(int, input().split(" ")))
if N == 0:
    print(X)
else:
    P_ls = list(map(int, input().split(" ")))
    P_ls.sort(reverse=True)
    diff = -1
    for i in range(101, -1, -1):
        if i not in P_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(" "))) -diff = x -result = 0 -if n != 0: -    ls = list(map(int, input().split(" "))) -    ls_remaind = [] -    for i in range(1, 102): -        if i not in ls: -            ls_remaind.append(i) -    for j in ls_remaind: -        if abs(x - j) == diff: -            result = min(result, j) -        elif abs(x - j) < diff: -            diff = abs(x - j) -            result = j +X, N = list(map(int, input().split(" "))) +if N == 0: +    print(X) -    result = x -print(result) +    P_ls = list(map(int, input().split(" "))) +    P_ls.sort(reverse=True) +    diff = -1 +    for i in range(101, -1, -1): +        if i not in P_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)