#include <stdio.h>

int main(void) {

  long x,n;
  scanf("%ld %ld", &x, &n);
  if (n == 0) {
    printf("%ld\n", x);
    return 0;
  }
  long list[102];
  for (long i = 0; i <= 101; i++) {
    list[i] = 0;
  }
  long p;
  for (long i = 0; i < n; i++) {
    scanf("%ld", &p);
    list[p] = 1;
  }
  for (long i = 0; ; i++) {
    if (list[x-i] == 0) {
      printf("%ld\n", x-i);
      return 0;
    }
    if (list[x+i] == 0) {
      printf("%ld\n", x+i);
      return 0;
    }
  }

  return 0;
}