#include <stdio.h>
#include <stdlib.h>
int main(){
  int a[200],d[200];
  int b,c,i,j,k,tmp,tmp2,count=0;
  scanf("%d %d",&b,&c);
  for(i=0;i<c;i++){
    scanf("%d",&a[i]);
  }
   for(i=0; i<c; ++i){
    for (j=i+1;j<c;++j){
      if(a[i] > a[j]){
        tmp =  a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  k=0;
  for(i=-5; i<101; ++i){
    for(j=0; j<c; ++j){
      if(i==a[j])count+=1;
    }
    if(count==0){
      d[k]=i;
      k+=1;
    }
    count=0;
  }
  for(i=0; i<k; ++i){
    for (j=i+1;j<k;++j){
  
      if(abs(b-d[i]) > abs(b-d[j])) {
       tmp2 =  d[i];
        d[i] = d[j];
        d[j] = tmp2;
      }
    }
  } 
  printf("%d",d[0]);
    
  return 0;
  }
