"use strict";

const main = (arg) => {
  const input = arg.trim().split("\n");
  const X = parseInt(input[0].split(" ")[0]);
  const N = parseInt(input[0].split(" ")[1]);
  if (N === 0) return console.log(X);

  const p_arr = input[1].split(" ").map(i => parseInt(i)).sort((a, b) => a - b);

  for (let i = 0; i < 10000; i++) {
    const current_m = X - i;
    if (!p_arr.includes(current_m)) return console.log(current_m);
    const current_p = X + i;
    if (!p_arr.includes(current_p)) return console.log(current_p);
  }

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