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

if n == 0:

    print(x)

    exit()

P = [*list(map(int,input().split()))]

ans = 100+100 # inf = x + d + 1

for d in range(100): # [0,100)

    now_diff = abs(ans - x)

    min_x, max_x = x - d, x + d

    if min_x not in P:

        if now_diff > abs(min_x - x): ans = x-d

    elif max_x not in P:

        if now_diff > abs(max_x - x): ans = x+d

print(ans)

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

if n == 0:

    print(x)

    exit()

P = [*list(map(int,input().split()))]

ans = 100 + 100 # inf = x + d + 1

for d in range(100): # [0,100)

    now_diff = abs(ans - x)

    min_x, max_x = x - d, x + d

    if min_x not in P:

        if now_diff > abs(min_x - x): ans = min_x

    elif max_x not in P:

        if now_diff > abs(max_x - x): ans = max_x

print(ans)

x, n = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
P = [*list(map(int, input().split()))]
ans = 100 + 100  # inf = x + d + 1
for d in range(100):  # [0,100)
    now_diff = abs(ans - x)
    min_x, max_x = x - d, x + d
    if min_x not in P:
        if now_diff > abs(min_x - x):
            ans = x - d
    elif max_x not in P:
        if now_diff > abs(max_x - x):
            ans = x + d
print(ans)

x, n = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
P = [*list(map(int, input().split()))]
ans = 100 + 100  # inf = x + d + 1
for d in range(100):  # [0,100)
    now_diff = abs(ans - x)
    min_x, max_x = x - d, x + d
    if min_x not in P:
        if now_diff > abs(min_x - x):
            ans = min_x
    elif max_x not in P:
        if now_diff > abs(max_x - x):
            ans = max_x
print(ans)

-            ans = x - d +            ans = min_x -            ans = x + d +            ans = max_x