// ABC170
function main(input) {
  var inputs = input.trim().split('\n');
  var X = inputs[0].split(' ')[0];
  var N = inputs[0].split(' ')[1];
  var P = typeof(inputs[1]) !== 'undefined' ? inputs[1].split(' ').map(n => parseInt(n, 10)) : [];

  var checker = [];
  for (var i = 0; i <= 100; i++) {
    checker.push(false);
  }

  for (var n = 0; n < N; n++) {
    checker[P[n]] = true;
  }

  var exists = false;
  var larger = 0;
  for (i = X; i <= 100; i++) {
    if (checker[i] === false) {
      larger = i;
      exists = true;
      break;
    }
  }
  if (!exists) larger = 101;

  exists = false;
  var smaller = 0;
  for (i = X; 0 <= i; i--) {
    if (checker[i] === false) {
      smaller = i;
      exists = true;
      break;
    }
  }
  if (!exists) smaller = -1;

  if (Math.abs(X - larger) < Math.abs(X - smaller)) {
    console.log(larger);
  } else {
    console.log(smaller);
  }
}

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