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

int compare_int(const void* a, const void* b)
{
	return *(int*)b - *(int*)a;
}

int main() {
	int x, n, p[110],ans=1000,t=0,as;
	scanf("%d%d", &x, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	qsort(p, n, sizeof(int), compare_int);

	for (int i = 101; i >= 0; i--) {
		if (i == p[t]) {
			t++;
			continue;
		}
		if (abs(i - x) <= ans) {
			as = i;
			ans = abs(i - x);
		}
	}
	printf("%d", as);
	return 0;
}