#include<stdio.h>

#define abs(OPR) ((OPR) < 0 ? -(OPR) : (OPR))

int main(void){
    register int i,j;
    int x,n;
    scanf("%d%d",&x,&n);
    int p[n];
    for(i = 0;i < n;i++)scanf("%d",&p[i]);
    int tdw,tup;
    for(tup = x;tup <= 101;tup++){
        for(j = 0;j < n;j++)if(p[j] == tup)goto cont1;
        break;
        cont1:;
    }
    for(tdw = x;tdw >= 0;tdw--){
        for(j = 0;j < n;j++)if(p[j] == tdw)goto cont2;
        break;
        cont2:;
    }
    printf("%d",abs(x-tdw) <= abs(x-tup) ? tdw : tup);
}