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

int x;

int cmp(const void *a, const void *b){
	if(abs(*(int*)a - x) == abs(*(int*)b - x))
		return *(int*)a - *(int*)b;
	else
		return abs(*(int*)a - x) - abs(*(int*)b - x);
}

int main(void){
	int n;
	scanf("%d %d", &x, &n);
	int *p = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++)
		scanf("%d", p + i);
	qsort(p, n, sizeof(int), cmp);
	int pointer = 1;
	if(p[0] != x){
		printf("%d\n", x);
		return 0;
	}
	for(int i = 1; ; i++){
		if(x - i != p[pointer++]){
			printf("%d\n", x - i);
			break;
		}else if(x + i != p[pointer++]){
			printf("%d\n", x + i);
			break;
		}
	}
	return 0;
}
