#include<stdio.h>

int main(){
    int x,n;
    scanf("%d%d",&x,&n);
    if(n==0){
        printf("%d",x);
        return 0;
    }
    int a[n];
    for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
    int l,h;
    l=x-1;
    h=x+1;
    while(1){
        int countL=0,countH=0;
        for(int i=0;i<n;i++){
            if(l==a[i]){
                countL++;
            }
            if(h==a[i])
            countH++;
        }
        if(countL>0 && countH>0){
            l--;
            h++;
        }
        else if(countL==0){
            printf("%d",l);
            return 0;
        }
        else if(countH==0){
            printf("%d",h);
            return 0;
        }
        
       
    }
}