function Main(arg) {
    var arg = arg.trim().split('\n');
    let x = Number(arg[0].split(' ')[0]);
    let n = arg[0].split(' ')[1];
    let p = arg[1];
    
    if( p === undefined || p.indexOf(x) < 0 ){
      console.log(x);
      return;
    }
    
    for(let i = 1; i < 101; i++){
      if(p.indexOf(`${x-1*i}`) < 0){
        console.log(x-1*i);
        return;
      } else if(p.indexOf(`${x+i}`) < 0 ){
        console.log(x+i);
        return;
      }
    }
    return;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));