#include<stdio.h>
int main(){
	char p[102] = {};
	int X, N;
	scanf("%d %d", &X, &N);
	if(N == 0)
		printf("%d", X);
	else if(N == 100){
		if(X <= 50)
			printf("0");
		else
			printf("101");
	}
	else{
		for(int i = 1; i <= N; i++){
			int IN;
			scanf("%d", &IN);
			p[IN] = 1;
		}
		int dist = 0;
		while(p[X+dist] && p[X-dist])
			dist++;
		if(p[X-dist] == 0)
			printf("%d", X - dist);
		else
			printf("%d", X + dist);
	}
	return 0;
}