r=require("fs").readFileSync("/dev/stdin","utf8").split("\n");
[x,n]=r[0].split(" ").map(x => parseInt(x));
p=r[1].split(" ").map(x => parseInt(x));
max=Math.max(...p, x);
min=Math.min(...p, x);
s=Array.from(Array(max-min+3), (v,k) => min-1+k).filter(x => p.indexOf(x)<0);
i=0;
s.reduce(function(ac,cv,idx){
    d=Math.abs(cv-x);
    if(ac>d)
    {
        i=idx;
        return d;
    }
    return ac;
},Number.POSITIVE_INFINITY);
console.log(s[i]);