"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) {
        console.log(X)
        return
    }
    const p = input[1].split(" ").map(n => parseInt(n));

    p.sort((a, b) => a - b)
    let lv = X
    let rv = X
    while (lv > 0) {
        if (p.includes(lv)) {
            lv--
        } else {
            break
        }
    }
    while (rv <= 100) {
        if (p.includes(rv)) {
            rv++
        } else {
            break
        }
    }
    if (Math.abs(X - lv) > Math.abs(X - rv)) {
        console.log(rv)
    } else {
        console.log(lv)
    }

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