#include<stdio.h>
int abs(int n)
{
	if (n < 0)
		n *= -1;
	return n;
}
int main()
{
	int x, n;
	scanf("%d %d", &x, &n);
	int i;
	int p;
	int u[102];
	for (i = 0; i < 102; i++)
		u[i] = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &p);
		u[p]++;
	}
	int ans = -1;
	for (i = 0; i < 102; i++)
		if (u[i] == 0)
			if (abs(x - i) < abs(x - ans))
				ans = i;
	printf("%d\n", ans);
	return 0;
}