const chunks = [];
process.stdin.on("data", (chunk) => {
  chunks.push(chunk);
});
process.stdin.on("end", () => {
  const lines = Buffer.concat(chunks)
    .toString("utf8")
    .trim()
    .split("\n")
    .map((line) => line.split(" ").map((s) => parseInt(s, 10)));
  const [X, N] = lines[0];
  const ps = lines[1];
  console.log(solve(X, N, ps));
});

function solve(X, N, ps) {
  const set = new Set(ps);
  for (let i = 0; i <= 100; i++) {
    if (!set.has(X - i)) return X - i;
    if (!set.has(X + i)) return X + i;
  }
  return X;
}
