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

int main()
{
  int x,n;
  scanf("%d%d",&x,&n);
  int p[n];
  int i;
  i = 0;
  while (i < n)
  {
    scanf("%d",&p[i]);
    i++;
  }
  i = -100;
  int j;
  j = 0;
  int ans;
  ans = -300;
  while (i >= -100 && i <= 200)
  {
    j = 0;
    while (j < n)
    {
      //printf("%d",ans);
      if (i == p[j])
      {
        break;
      }
      if (j == n - 1)
      {
        //printf("%d",abs(x - ans));
        if (abs(x - ans) > abs(x - i))
        {
          ans = i;
        }
      }
      j++;
    }
    i++;
  }
  printf("%d",ans);
}