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



if N == 0:

  ans = X

else:

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

  ans = 0

  for i in range(200):

    if i in p:

      continue

    else:

      dis = i - X

      if dis < abs(ans - X):

        ans = i



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



if N == 0:

  ans = X

else:

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

  ans = 0

  for i in range(200):

    if i in p:

      continue

    else:

      dis = abs(i - X)

      if dis < abs(ans - X):

        ans = i



print(ans)

X, N = list(map(int, input().split()))
if N == 0:
    ans = X
else:
    p = list(map(int, input().split()))
    ans = 0
    for i in range(200):
        if i in p:
            continue
        else:
            dis = i - X
            if dis < abs(ans - X):
                ans = i
print(ans)

X, N = list(map(int, input().split()))
if N == 0:
    ans = X
else:
    p = list(map(int, input().split()))
    ans = 0
    for i in range(200):
        if i in p:
            continue
        else:
            dis = abs(i - X)
            if dis < abs(ans - X):
                ans = i
print(ans)

-            dis = i - X +            dis = abs(i - X)