function Main(input) {
  var X = parseInt(input.split(/\n| /)[0]);
  var N = parseInt(input.split(/\n| /)[1]);
  var p = input.split("\n")[1].split(" ").map(n => parseInt(n));
 

  if (N === 0) {
    console.log(X);
  } else {
    for(i = X-1; i >= 0; i--){
      if(p.indexOf(i) === -1){
        console.log(i);
        break;
      } else if( p.indexOf(2 * X - i) === -1){
          console.log(2 * X - i);
          break;
        }
      }
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));