#include <stdio.h>
#include <stdlib.h>
int main(void){
	int x, n;
	int *p;
	int minor = -1;
	int major = 101;
	int in_p;
	scanf("%d", &x);
	scanf("%d", &n);
	p = (int *)malloc(sizeof(int) * n);
	for(int i=0; i<n; i++){
		scanf("%d", &p[i]);
	}
	for(int j=0; j<=x; j++){
		in_p = 0;
		for(int k=0; k<n; k++){
			if(p[k] == x-j){
				in_p = 1;
				break;
			}
		}
		if(in_p == 0){
			minor = x-j;
			break;
		}
	}
	for(int j=x; j<=100; j++){
		in_p = 0;
		for(int k=0; k<n; k++){
			if(p[k] == j){
				in_p = 1;
				break;
			}
		}
		if(in_p == 0){
			major = j;
			break;
		}
	}
	if(x-minor <= major-x){
		printf("%d\n", minor);
	}
	else{
		printf("%d\n", major);
	}
	return 0;
}