function main(input) {
  let args = input.split('\n');
  let a = 0;
  let [x, n] = args[a++].split(' ').map((e) => +e);
  if (n == 0) {
    console.log(x);
    return;
  }
  let arr = args[a++].split(' ');
  let map = {};
  for (let i = 0; i < n; ++i) {
    const e = +arr[i];
    if (!map[e]) {
      map[e] = 1;
    }
  }
  let min = null;
  let max = null;
  for (let i = x; x > -1; --i) {
    if (!map[i]) {
      min = i;
      break;
    }
  }
  for (let i = x; x < 101; ++i) {
    if (!map[i]) {
      max = i;
      break;
    }
  }
  let diffA = x - min;
  let diffB = max - x;
  if (diffA == diffB) {
    console.log(Math.min(min, max));
  } else if (diffA < diffB) {
    console.log(min);
  } else {
    console.log(max);
  }
}

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