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

#define mod 1000000007
#define limit 200001
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i = 0; i < n; i++)
#define max(a,b) {if(a>b){return a;}return b;}
#define min(a,b) {if(a<b){return a;}return b;}
int up_int(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_int(const void *a, const void *b){return *(int*)b - *(int*)a;}
int up_char(const void *left, const void *right) {return strcmp((char *)left,(char *)right);}
int down_char(const void *left, const void *right) {return strcmp((char *)right,(char *)left);}

int check(int a[],int n,int x){
    int flag = 0;
    for(int i = 0; i < n; i++){
        if(a[i] == x){
            flag = 1;
            break;
        }
    }
    if(flag == 1) return 0;
    else return 1;
}
int main(){
    int i,x,n,abs_min=10000,tmp,min=101;
    int p[100];
    
    scanf("%d %d",&x,&n);
    for(i = 0; i < n; i++) scanf("%d",&p[i]);
    
    if(n == 0){
        printf("%d\n",x);
        return 0;
    }
    
    qsort(p,n,sizeof *p,up_int);
//    for(i = 0; i < n; i++) printf("%d\n",p[i]);
    
    for(i = 101; i >= -1; i--){
        tmp = abs(i-x);
//        printf("tmp = %d\n",tmp);
        if(tmp <= abs_min && check(p,n,i) == 1 && i < min){
            min = i;
            abs_min = tmp;
//            printf("%d is true!\n",min);
        }
    }
    printf("%d\n",min);
    return 0;
}

