#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<ctype.h>

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	int X,N;
	scanf("%d %d",&X,&N);
	int p[N];
	int sakoda=0;
	for(int i=0;i<N;i++){
		scanf("%d",&p[i]);
		if(X == p[i]){
			sakoda =1;
		}
	}
	if(sakoda == 0){
		printf("%d",X);
		return 0;
	}
	
	 int andy;
	 int count = 1;
	while(1) {
		andy = 0;
		for(int i=0;i<N;i++){
			if(X-count == p[i]){
				andy = 1;
			}
		}
		if(andy == 0){
			printf("%d",X-count);
			return 0;
		}
		
		andy = 0;
		for(int i=0;i<N;i++){
			if(X+count == p[i]){
				andy = 1;
			}
		}
		if(andy == 0){
			printf("%d",X+count);
			return 0;
		}
		count++;
	}
}
