#include <stdio.h>

int zettaiti(int num){
  if(num < 0)
    num = -num;
  
  return num;
}

int main(){
  
  int x, n;
  int p[100];
  int number[101] = {0};
  int i;
  int diff;
  int answer;
  
  scanf("%d %d", &x, &n);
  
  if(n == 0){
    printf("%d\n", x);
    return 0;
  }
  else{
    
    for(i = 0; i < n; i++){
      scanf("%d", &p[i]);
      number[p[i]] = 1;
    }   
    
    for(i = 0; i <= 100; i++){
      if(number[i] == 0){
        if(i == 0 || diff > zettaiti(x - i)){
          diff = zettaiti(x - i);
          answer = i;
        }
      }
    }
  }
  
  printf("%d\n", answer);
  
  return 0;
}