#include <stdio.h>

int main(void)
{
	int a[110] = { 0 };
	int x, n;
	int ans1 = 0, kyo = 0;
	int f[110] = { 0 };
	scanf("%d%d", &x, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		f[a[i]] = 1;
	}

	for (int i = 1; i <= 100; i++) {
		if (i < x) {
			if (f[i] == 0) {
				ans1 = i;
				kyo = x - i;
			}
		}
		else if (x < i) {
			if (ans1 == 0) {
				ans1 = i;
				kyo = i - x;
			}
			else
				if (f[i] == 0 && kyo > i - x)
					ans1 = i;
		}
	}

		if (n == 0)
			printf("%d\n", x);
		else if (ans1)
			printf("%d\n", ans1);

		return 0;

	}