#include <stdio.h>

int main(void)
{	int X, N;
	int num[102] = {0};
	int i, tmp, left, right, 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]++;
	}

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

	left = X - 1;
	while (left != 0)
	{
		if (num[left] == 0)
			break;
		left--;
	}
	right = X + 1;
	while (right != 101)
	{
		if (num[right] == 0)
			break;
		right++;
	}

	if (right - X < X - left)
		ans = right;
	else
		ans = left;
	printf("%d\n", ans);

	return (0);
}
