#include<stdio.h>
signed main(){
    int X,N,p[105];
    scanf("%d %d",&X,&N);
    int i;
    for(i=0;i<N;i++){
    scanf("%d",&p[i]);
    }
    int flag[105]={};
    int ans=0;
    for(i=0;i<N;i++){
        flag[p[i]]=1;
    }
    for(i=1;i<=101;i++){
        if(flag[i]==0){
    }
            int abs1,abs2;
            abs1=X-abs2;
            abs2=X-i;
            if(abs1<0){
                abs1=abs1*-1;
            }
            if(abs2<0){
                abs2=abs2*-1;
            }
            if(abs1>abs2){
                ans=i;
            }}
            printf("%d\n",ans);
    return(0);
}