#include<stdio.h>
signed main(){
    int x,n,i,p[1000];
    scanf("%d %d",&x,&n);
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
    }int f[1000]={},a=0;
    for(i=0;i<n;i++){
        f[p[i]]=1;
    }for(i=1;i<=101;i++){
        if(f[i]==0){
            int ab1,ab2;
            ab1=x-a;
            ab2=x-i;
        if(ab1<0){
            ab1=ab1*-1;
        }if(ab2<0){
            ab2=ab2*-1;
        }if(ab1>ab2){
            a=i;
        }
    }}printf("%d\n",a);
    return(0);
}
