function Main(input){
  input = input.trim().split('\n').map(x=>x.split(' ').map(y=>parseInt(y)));
  var x = input[0][0];
  var n = input[0][1];
  if (n == 0){
    var ps = [];
  }else{
    var ps = input[1];
  }
  var inPs = Array(301).fill(0);
  for (let i=0;i<ps.length;i++){
    inPs[ps[i] + 100] = 1;
  }
  for (let i=0;i<100;i++){
    if (inPs[x+100-i] === 0){
      var ans = x-i;
      break;
    }else if (inPs[x+100+i] === 0){
      var ans = x+i;
      break;
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));