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

int	main(void)
{
  	int	x;
  	int	n;
  	int	p[102];
  	int	q[20004];
  	int	i;
  	int num;
   	int	tmp;
  
  	for (i=1; i<=100; i++)
    {
        p[i] = 0;
    }
    
    for (i=1; i<=20000; i++)
    {
        q[i] = i - 10000;
    }

  	scanf("%d %d\n", &x, &n);
  	for (i=1; i<=n; i++)
    {
      	scanf("%d", &p[i]);
    }
  	
  	for (i=1; i<=100; i++)
    {
      	if (p[i] > 0)
        {
          	q[ p[i] + 10000 ] = 10000;
        }
    }
  
  	num = 0;
  	tmp = 1000;
  	for (i=1; i<=20000; i++)
    {
      	if (tmp > abs( q[i] - x ) )
        {
          	tmp = abs( q[i] - x );
        	num = i - 10000;
 //       	printf("%d %d, ", num, tmp);
        }
    }
  
  	printf("%d", num);
  	return (0);
}