#include <stdio.h>

int main(){
  int x, n;  scanf("%d %d", &x, &n);
  int table[105] = {0};
  for(int i=0; i<n; i++){
    int p;  scanf("%d", &p);
    table[p] = 1;
  }

  int up = x;
  while(table[up])  up++;
  int under = x;
  while(table[under]) under--;

  int ans;
  if(up-x < x-under)  ans = up;
  else                ans = under;
  
  printf("%d\n", ans);
  
  return 0;
}
