#include<iostream>
using namespace std;

int main(){

    int X, N;
    cin >> X >> N;
    if(N == 0){
        cout << X << endl;
        return 0;
    }

    int P[N];
    int pi;
    int i;
    for(i=0; i<N; i++){
        cin >> pi;
        P[i] = pi;
    }

    int abs_num_p, abs_num_n;
    abs_num_p = X + 1;
    abs_num_n = X - 1;

    int iter;
    bool flag_p;
    bool flag_n;
    iter = 0;
    
    while(iter <= (N / 2)){
        flag_p = false;
        flag_n = false;
        for (i=0; i<N; i++){
            if(P[i] == abs_num_p){
                flag_p = true;
            }
            if(P[i] == abs_num_n){
                flag_n = true;
            }

        }
        if(     flag_p ==  true and flag_n ==  true){
            abs_num_p += 1;
            abs_num_n += 1;
            continue;
        }
        else if(flag_p ==  true and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        else if(flag_p == false and flag_n ==  true){
            cout << abs_num_p << endl;
            return 0;
        }
        else if(flag_p == false and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        iter += 1;
    }
    return 0;
}
