#include <stdio.h>

int main(void)
{	int X, N;
	int num[101] = {0};
	int i, tmp, sub, ans;

	scanf("%d %d", &X, &N);

	if (N == 0)
	{
		printf("%d\n", X);
		return (0);
	}

	for (i = 0; i < N; i++)
	{
		scanf("%d", &tmp);
		num[tmp]++;
	}

	i = 100;
	sub = X - 101;
	if (sub < 0)
		sub *= -1;
	while (0 <= i)
	{
		if (0 < num[i])
		{
			i--;
			continue;
		}
		tmp = X - i;
		if (tmp < 0)
			tmp *= -1;
		if (tmp <= sub)
			ans = i;
		else
			break;
		sub = X - i;
		if (sub < 0)
			sub *= -1;
		i--;
	}
	printf("%d\n", ans);

	return (0);
}
