#include <stdio.h>
int main(void){
    // Your code here!
    int X,N;
    int p[100];
    int tmp;
    
    scanf("%d%d",&X,&N);
    tmp = X;
    
    for(int i = 0; i < N; i++){
        scanf("%d",&p[i]);
    }
    
    for(int i = 0; i <= 51; i++){
        int flag_p = 0;
        int flag_m = 0;
        for(int j = 0; j < N; j++){
            if(p[j] == X-i){
                flag_m = 1;
            }
            if(p[j] == X+i){
                flag_p = 1;
            }
        }
        
        if(flag_m == 0){
            printf("%d\n",X-i);
            return 0;
        }
        else if(flag_p == 0){
            printf("%d\n",X+i);
            return 0;
        }
    }
}
