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

int main(void){
    int x, n, i, s[102]={0}, min=99999, ans;
    scanf("%d%d",&x,&n);
    int p[n];
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        s[p[i]] = 1;
    }

    for(i=0;i<102;i++){
        if(s[i] != 1){
            if(min > abs(x-i)){
                min = abs(x-i);
                ans = i;
            }else{
                continue;
            }
        }
    }

    printf("%d",ans);

    return 0;
}