#include<stdio.h>

int main(void){

    int X, N,min=100, ans;
    int p[100], er[200], flag;
    scanf("%d %d", &X, &N);

    for(int j=1;j<200;j++){
        er[j]=0;
    }
    
    if(N==0){
        printf("%d",X);
    }
    else{
        for(int i=0;i<N;i++){
            scanf("%d", &p[i]);
            ans = X-p[i];
            if(ans>0){
                er[2*ans-1]=1;
            }
            else if(ans<0){
                er[2*ans]=1;
            }
            else{
                er[0]=1;
            }
        }

        for(int k=0;k<200;k++){
            if(er[k]!=0){
                if(k%2==1){
                    printf("%d", X-(int)((k+1)/2));
                    break;
                }
                else if(k%2==0){
                    printf("%d", X+(int)((k+1)/2));
                }
            }
        }

        
    }
    return 0;
}