const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const rows = input.split('\n')
    const [X, N] = rows[0].split(' ').map(n => n - 0)
    const P = rows[1].split(' ').map(n => n - 0)

    for (let i = 0; i < 52; i++) {
        if (P.indexOf(X - i) === -1) {
            console.log(X - i)
            break
        }
        if (P.indexOf(X + i) === -1) {
            console.log(X + i)
            break
        }
    }

})(input)
