#include <stdio.h>

int main(void) {
	int x, n;
	scanf("%d%d", &x, &n);

	int arr[101] = {0};

	while (n--) {
		int p;
		scanf("%d", &p);
		arr[p] = 1;
	}

	for (int i = 0; i <= 100; i++) {
		if (x-i < 0)
			printf("%d\n", x-i);
		else if (x+i > 100)
			printf("%d\n", x+i);
		else if (!arr[x-i])
			printf("%d\n", x-i);
		else if (!arr[x+i])
			printf("%d\n", x+i);
		else
			continue;

		break;
	}
}
