#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
  int x,y,z;
  int p[100];
  int i;
  int a,b;
  scanf("%d %d", &x,&y);

  for(i = 0; i< 100; i++) p[i] = i+1;
  for(i = 0; i < y; i++) {
    if(i == y-1) {
      scanf("%d", &z);
      p[z-1] = 0;
    } else {
      scanf("%d ", &z);
      p[z-1] = 0;
    }
  }

  for(i=x-1;; i--) {
    if(p[i] != 0 || i < 0) {
      break;
    }
  }
  if(i >= 0) a = p[i];
  else a = 0;

  for(i=x-1;; i++) {
    if(p[i] != 0 || i == 100) {
      break;
    }
  }
  if(i != 100) b = p[i];
  else b = 101;

  if(abs(x-a) == abs(x-b)) {
    printf("%d\n",a);
  } else if(abs(x-a) > abs(x-b)) {
    printf("%d\n",b);
  } else if(abs(x-a) < abs(x-b)) {
    printf("%d\n",a);
  }
  return 0;
}
