#include <stdio.h>
#include <math.h>

int main(){
    int x, n;
    scanf("%d%d", &x, &n);

    if(n == 0)
        printf("%d", x);
    else{
        int p[101],pp[101];
        int menor_num = 101;
        int maior_num = 0;
        int cont = 0;

        for(int i = 0; i < n; ++i){
            scanf("%d", &p[i]);
        }

        for(int j = 0; j < n; ++j){
            if(p[j] <= menor_num)
                menor_num = p[j];
            if(p[j] >= maior_num)
                maior_num = p[j];
        }

        for(int t = 0; t < 101; ++t){
            int c = 0;
            for(int s = 0; s < n; ++s){
                if(t == p[s])
                    c = -1;
            }
            if(c == 0){
                pp[cont] = t;
                ++cont;
            }
        }

        int resp = 101;

        for(int k = 0; k < cont; ++k){
             if(abs(pp[k] - x) <= abs(resp - x)){
                if(abs(pp[k] - x) == abs(resp - x)){
                    if(pp[k] < resp)
                        resp = pp[k];
                }
                else
                    resp = pp[k];
             }
        }
        
    
        printf("%d", resp);
    }

    return 0;
}