#include<stdio.h>
#include<math.h>
#define N 100
int search(int a[],int n,int tmp) {
    for (int i=0;i<n;i++) {
        if (a[i]==tmp) return 1;
    }
    return 0;
}
int main() {
    int x,n,tmp;
    int p[N]={0};

    scanf("%d %d",&x,&n);
    for (int i=0;i<n;i++) scanf("%d",&p[i]);
    
    int tmp1=x;
    while(search(p,n,tmp1)) {
        tmp1--;
    }
    int tmp2=x;
    while(search(p,n,tmp2)) {
        tmp2++;
    }
    if(tmp2-x>=x-tmp1)tmp=tmp1;
    else tmp=tmp2;
    
    printf("%d\n",tmp);
  	return 0;
}