#include"stdio.h"

int main(void)
{
  unsigned int X,N;
  int i,n,ans;
  unsigned int p[100];
  unsigned int check[100] = {0};
  
  //input
  scanf("%d %d",&X,&N);
  for(i=0;i<N;i++)
  {
  	scanf("%d",&p[i]);
    check[p[i]] = p[i];
  }
  //check
	while(1)
    {
    	if(check[X-n]==0)
        {
          ans =X-n;
        	break;
        }else if(check[X+n]==0){
          ans =X+n;
          break;
        }
      n++;
    }
  //output
  printf("%d",ans);

  
  return 0;
}