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

int x, n, p[100];
int check(int x) { return ((x>=1)&&(x<=100)) && p[x-1]==0; }
int main()
{
  scanf("%d %d", &x, &n);
  for ( int i=0; i<n; i++ ) {
    int num;
    scanf("%d", &num);
    p[num-1] = 1;
  }
  for ( int i=0; i<100; i++ ) {
    if ( check(x-i) ) {
      printf("%d\n", x-i);
      break;
    } else if ( check(x+1) ) {
      printf("%d\n", x+1);
      break;
    }
  }
  return 0;
}