#include <stdio.h>
int main(void){
    // Your code here!
    
    int entry_point,entry_num;
    int entry[100]={0};
    int i,flg;
    int abs_num=0,answer;
    
    //入力
    scanf("%d",&entry_point); //整数X
    scanf("%d",&entry_num); //入力個数
    
    for(i=0; i<entry_num; i++){
        scanf("%d",&entry[i]);
    }
    

    while(1){
        flg=0;
        answer = entry_point - abs_num;
        for(i=0; i<entry_num; i++){
            if(answer == entry[i]){
                flg = 1;
                break;
            }
        }
        if(flg == 0){
            //発見
            break;
        }
        flg=0;
        answer = entry_point + abs_num;
        for(i=0; i<entry_num; i++){
            if(answer == entry[i]){
                flg = 1;
                break;
            }
        }
        if(flg == 0){
            //発見
            break;
        }
        abs_num++;
    }
        
        
    printf("%d\n",answer);
    
}
