function Main(input) {
  // input
  const inputArr = input.split(/\n| /);

  const x = parseInt(inputArr[0], 10);
  const n = parseInt(inputArr[1], 10);

  let pArr = [];
  for (let i = 0; i < n; i++) {
    pArr[i] = parseInt(inputArr[i + 2], 10);
  }

  // process
  const eX = pArr.find((e) => e === x);

  let a;

  if (eX) {
    for (let i = 1; i < 100; i++) {
      const lX = x - i;
      const mX = x + i;

      if (!pArr.find((e) => e === lX)) {
        a = lX;
        break;
      } else if (!pArr.find((e) => e === mX)) {
        a = mX;
        break;
      }
    }
  } else {
    a = x;
  }

  console.log(a);
}

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