# -*- coding: utf-8 -*-

# 標準入力の取得

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

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



# 求解処理

result = int()

a = 0

while True:

    x_minus = X - a

    if x_minus not in p:

        result = x_minus

        break

    x_plus = X + a

    if x_plus not in p:

        result = x_plus

        break



    a += 1



# 結果出力

print(result)

# -*- coding: utf-8 -*-

def get_input() -> tuple:

    """

    標準入力を取得する.



    Returns:\n

        tuple: 標準入力

    """

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

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



    return X, N, p





def main(X: int, N: int, p: list) -> None:

    """

    求解処理を行う.



    Args:\n

        X (int): 整数

        N (int): 長さ

        p (list): 整数列

    """

    # 求解処理

    ans = 0

    diff = 0

    while True:

        # Xとの差がdiffのうち小さいほう

        x_minus = X - diff

        if x_minus not in p:

            ans = x_minus

            break

        # Xとの差がdiffのうち大きいほう

        x_plus = X + diff

        if x_plus not in p:

            ans = x_plus

            break



        diff += 1



    # 結果出力

    print(ans)





if __name__ == "__main__":

    X, N, p = get_input()

    main(X, N, p)

# -*- coding: utf-8 -*-
# 標準入力の取得
X, N = list(map(int, input().split()))
p = list(map(int, input().split()))
# 求解処理
result = int()
a = 0
while True:
    x_minus = X - a
    if x_minus not in p:
        result = x_minus
        break
    x_plus = X + a
    if x_plus not in p:
        result = x_plus
        break
    a += 1
# 結果出力
print(result)

# -*- coding: utf-8 -*-
def get_input() -> tuple:
    """
    標準入力を取得する.
    Returns:\n
        tuple: 標準入力
    """
    X, N = list(map(int, input().split()))
    p = list(map(int, input().split()))
    return X, N, p


def main(X: int, N: int, p: list) -> None:
    """
    求解処理を行う.
    Args:\n
        X (int): 整数
        N (int): 長さ
        p (list): 整数列
    """
    # 求解処理
    ans = 0
    diff = 0
    while True:
        # Xとの差がdiffのうち小さいほう
        x_minus = X - diff
        if x_minus not in p:
            ans = x_minus
            break
        # Xとの差がdiffのうち大きいほう
        x_plus = X + diff
        if x_plus not in p:
            ans = x_plus
            break
        diff += 1
    # 結果出力
    print(ans)


if __name__ == "__main__":
    X, N, p = get_input()
    main(X, N, p)

-# 標準入力の取得 -X, N = list(map(int, input().split())) -p = list(map(int, input().split())) -# 求解処理 -result = int() -a = 0 -while True: -    x_minus = X - a -    if x_minus not in p: -        result = x_minus -        break -    x_plus = X + a -    if x_plus not in p: -        result = x_plus -        break -    a += 1 -# 結果出力 -print(result) +def get_input() -> tuple: +    """ +    標準入力を取得する. +    Returns:\n +        tuple: 標準入力 +    """ +    X, N = list(map(int, input().split())) +    p = list(map(int, input().split())) +    return X, N, p + + +def main(X: int, N: int, p: list) -> None: +    """ +    求解処理を行う. +    Args:\n +        X (int): 整数 +        N (int): 長さ +        p (list): 整数列 +    """ +    # 求解処理 +    ans = 0 +    diff = 0 +    while True: +        # Xとの差がdiffのうち小さいほう +        x_minus = X - diff +        if x_minus not in p: +            ans = x_minus +            break +        # Xとの差がdiffのうち大きいほう +        x_plus = X + diff +        if x_plus not in p: +            ans = x_plus +            break +        diff += 1 +    # 結果出力 +    print(ans) + + +if __name__ == "__main__": +    X, N, p = get_input() +    main(X, N, p)