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

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return -*(int*)p + *(int*)q;
}//大きい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	int x,p[110],min=101,n,temp;

	scanf("%d%d",&x,&n);
	for(int i=0;i<n;i++){
scanf("%d",&p[i]);
}
if(n==0){
	printf("%d\n",x);
	return 0;
}
	//qsort(p,n,sizeof(int),cmp);

for(int j=101;j>=-1;j--){
  temp=0;
for(int k=0;k<n;k++){
	if(j==p[k]){
      temp=1;
		break;
	}

}
    	if(abs(j-x)<=abs(min-x)&&temp==0){
		min=j;
	}

}

	printf("%d\n",min);
	return 0;
}
