#include<stdio.h>


int main(){
  int x,n;
  scanf("%d%d",&x,&n);
  if(n==0){
    printf("%d\n",x);
    return 0;
  }
  int i,j,p[n],out1,out2,ans;
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  for(i=0;i<n;i++){
    out1=0;
    out2=0;
    for(j=0;j<n;j++){
      if(x+i==p[j]){
        out1=1;
      }
      if(x-i==p[j]){
        out2=1;
      }
    }
    if(out2==0){
      printf("%d\n",x-i);
      return 0;
    }
    if(out1==0){
      printf("%d\n",x+i);
      return 0;
    }
  }

}
