#include<stdio.h>

int main(void)
{
  int x,n,p[101] = {0},k[101] = {0},low,up,i,j;
  
  scanf("%d%d",&x,&n);
  
  if(n==0){
    printf("%d", x);
    return 0;
  }
  
  for(i=0;i<n;i++)
    scanf("%d", &p[i]);
  
  for(i=1;i<=100;i++)
      k[i] = i;
  
  for(i=0;i<=n;i++){
    for(j=1;j<=100;j++){
      if(p[i]==k[j]){
        k[j] = 0;
      }
    }
  }
  
  for(i=x;i>0;i--){
    if(k[i]!=0){
      low = k[i];
      break;
    }
  }
  
  for(i=x;i<101;i++){
    if(k[i]!=0){
      up = k[i];
      break;
    }
   }
    
    if(x - low <= up -x)
       printf("%d", low);
    else
       printf("%d", up);
    
    return 0;
}
