def c_forbidden_list():

    X, N = [int(i) for i in input().split()]

    P = set([int(i) for i in input().split()]) if N != 0 else []



    if not P:

        return X



    minimum = float('inf')

    ans = -float('inf')

    for t in range(102):

        if (not t in P) and (abs(X - t) < minimum):

            minimum = abs(X - t)

            ans = t

    return ans



print((c_forbidden_list()))
def c_forbidden_list(RANGE=101):

    X, N = [int(i) for i in input().split()]

    P = set([int(i) for i in input().split()]) if N != 0 else set()



    for t in range(RANGE + 1):

        if X - t not in P:

            return X - t

        elif X + t not in P:

            return X + t

    return None  # 入力の制約上ここには来ない



print((c_forbidden_list()))
def c_forbidden_list():
    X, N = [int(i) for i in input().split()]
    P = set([int(i) for i in input().split()]) if N != 0 else []
    if not P:
        return X
    minimum = float("inf")
    ans = -float("inf")
    for t in range(102):
        if (not t in P) and (abs(X - t) < minimum):
            minimum = abs(X - t)
            ans = t
    return ans


print((c_forbidden_list()))

def c_forbidden_list(RANGE=101):
    X, N = [int(i) for i in input().split()]
    P = set([int(i) for i in input().split()]) if N != 0 else set()
    for t in range(RANGE + 1):
        if X - t not in P:
            return X - t
        elif X + t not in P:
            return X + t
    return None  # 入力の制約上ここには来ない


print((c_forbidden_list()))

-def c_forbidden_list(): +def c_forbidden_list(RANGE=101): -    P = set([int(i) for i in input().split()]) if N != 0 else [] -    if not P: -        return X -    minimum = float("inf") -    ans = -float("inf") -    for t in range(102): -        if (not t in P) and (abs(X - t) < minimum): -            minimum = abs(X - t) -            ans = t -    return ans +    P = set([int(i) for i in input().split()]) if N != 0 else set() +    for t in range(RANGE + 1): +        if X - t not in P: +            return X - t +        elif X + t not in P: +            return X + t +    return None  # 入力の制約上ここには来ない