#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int x, n, min;
	int p[101] = { 0 }, count[101] = { 0 };

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

	for (int i = 0; i < n; i++) {
		int num = p[i];
		count[num]++;
	}

	min = x;
	for (int i = 0; i < 101; i++) {
		if (count[i] == 0) {
			if (abs(i - x) < min) {
				min = abs(i - x);
				n = i;
			}
		}
	}

	if (101 - x < min) n = 101;
	printf("%d\n", n);

	return 0;
}