#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long

int comp(const void *a, const void *b)
{ //昇順
  return *(int *)a - *(int *)b;
}

int main(void)
{
  int x, n;
  int p[101];
  int i;
  scanf("%d %d", &x, &n);
  for (i = 0; i < n; i++)
  {
    scanf("%d", &p[i]);
  }
  if (n == 0)
  {
    printf("%d\n", x);
    return 0;
  }

  qsort(p, n, sizeof(int), comp);

  int *sr = bsearch(&x, p, n, sizeof(int), comp);
  if (sr == NULL)
  {
    printf("%d\n", x);
    return 0;
  }
  int pos = sr - p;
  int lx, rx, lpos, rpos;
  lx = x - 1;
  rx = x + 1;
  lpos = pos - 1;
  rpos = pos + 1;
  while (1)
  {
    if (lx != p[lpos])
    {
      printf("%d\n", lx);
      break;
    }
    if (rx != p[rpos])
    {
      printf("%d\n", rx);
      break;
    }
    lpos--;
    rpos++;
    lx--;
    rx++;
  }

  return 0;
}
