function main(input){
  input = input.split('\n');
  const [X, N] = input[0].split(' ').map(Number);
  if(N===0) return console.log(X);
  const p = input[1].split(' ').map(Number);

  let answer = X;
  let i=0;
  while(true){
    if(!p.includes(answer-i)) {return console.log(answer-i);}
    if(!p.includes(answer+i)) {return console.log(answer+i);}
    i++;
  }

}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());