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

int main(void) {
	int x,n,p[n];
	int seek=0;
	scanf("%d%d",&x,&n);
	if(n==0){
		printf("%d",x);
		return 0;
	}
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(int l=1;l<111;l++){
		for(int i=0;i<n;i++){
			if(x-l != p[i]){
				seek++;
			}
		}
		if(seek==n){
			printf("%d",x-l);
			return 0;
		}
		seek = 0;
		for(int i=0;i<n;i++){
			if(x+l != p[i]){
				seek++;
			}
		}
		if(seek==n){
			printf("%d",x+l);
			return 0;
		}
	}
}
