function main(lines) {
  const [X, N] = splitN(lines[0]);
  if (N == 0) return console.log(X);
  const ps = splitN(lines[1]);

  let res, n = 0;
  while (true) {
    if (!ps.includes(X-n)) {
      res = X-n;
      break;
    }
    if (!ps.includes(X+n)) {
      res = X+n;
      break;
    }
    n++;
  }
  
  console.log(res);
}


main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );



function splitN(s) {
  return s.split(' ').map(Number);
}