#include<stdio.h>
#include<stdlib.h>
int main(void){
  
  int x,n,i,j,ans;
  int *p;
  int min = 1000,m,flag=1;
  
  scanf("%d %d",&x,&n);
  p = (int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
	scanf("%d",&p[i]);
  }
  
  for(i=1;i<101;i++){
    m = x - i;
    if(m<0) m=m*-1;
    
	if(m < min){
      
    for(j=0;j<n;j++){
        if(i == p[j]) {
          flag = 0;
          break;
        }
    }
      if(flag==1){
    	 min = m;
        ans = i;
      }
      flag = 1;

    }
  }
  
  printf("%d\n",ans);
  free(p);
  
 return 0; 
}