#include <stdio.h>
#include <math.h>

int main(void) {
	int x, n;
	int p[100 + 1] = { 0 };
	int i, flag = 1;
	int isOK = 1;
	int ans1, ans2;

	scanf("%d", &x);
	scanf("%d", &n);

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

	for (i = 1; i < n+1; i++) {
		scanf("%d", &p[i]);
	}

	ans1 = x;
	ans2 = x;
	for (i = 1; i < n + 1; i++) {
		isOK = 1;
		if (p[i] == ans1) {
			ans1++;
			flag = 0;
			isOK = 0;
		}
		if (p[i] == ans2) {
			ans2--;
			flag = 0;
			isOK = 0;
		}
		if (isOK == 0) {
			i = 0;
		}
	}

	if (flag == 1) {
		printf("%d\n", x);
	}
	else {
		if (abs(x - ans2) == abs(x - ans1)) {
			printf("%d\n", ans2);
		}
		else if (abs(x - ans2) < abs(x - ans1)) {
			printf("%d\n", ans2);
		}
		else {
			printf("%d\n", ans1);
		}
	}

	return 0;
}