#include<stdio.h>

int main(){
	int x,n;
	scanf("%d %d",&x,&n);
	
	if(n == 0){
		printf("%d",x);
		return 0;
	}
	int a[100] = {0};
	int i,j;
	
	for(i = 0;i < n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp] = 1;
	}
	
		
	for(i = x,j=x;i >= 0,j <= 100;i--,j++){
		
		
		if(a[i] == 0 && a[j] != 0){
			printf("%d\n",i);
			break;
		}
			
		
		if(a[i] != 0 && a[j] == 0){
			printf("%d\n",j);
			break;
		}
			
			
		if(a[i] == 0 && a[j] == 0){
			printf("%d\n",i);
			break;
		}
			
	}
}