#include <stdio.h>
#include <stdlib.h>
int main(void){
  int X,N;
  scanf("%d %d", &X, &N);
  int value = 100;
  int p[N], test[value];
  for(int i=0;i<N;i++){
    scanf("%d", &p[i]);
  }

  for(int i=0;i<value;i++){
    test[i]=i+1;
    for(int j=0;j<N;j++){
      if(test[i]==p[j]){
        test[i] = -1;
        break;
      }
    }
  }

  int dist[N], ans, k=0, min=100;
  for(int i=0;i<value;i++){
    if(test[i]==-1){
      dist[i] = 200;
    }else{
      dist[i] = abs(X - test[i]);
    }
    if(dist[i]<min){
      ans = i;
      min = dist[i];
    }
  }
  printf("%d\n", test[ans]);
}