"use strict";

function main(arg) {
    const input = arg.split("\n")
    const [X,N] = input[0].split(" ").map(x=>Number(x))
    if(N===0) {
        console.log(X)
        return
    }
    const p = input[1].split(" ").map(x=>Number(x))
    //console.log(X)
    //console.log(p)
    
    const sortedP = p.sort((a,b)=>a-b)
    //console.log(sortedP)
    
    let notMatched = []
    for(let i = sortedP[0]-1; i < sortedP[N-1]+1; i++) {
        //console.log(`i=${i}, X=${X}`)
        if(sortedP.indexOf(i) < 0) {
            notMatched.push(i)
        }
    }
    //console.log(notMatched)
    
    let sortedNotMatched = notMatched.sort((a,b)=>Math.abs(X-a) - Math.abs(X-b))
    console.log(sortedNotMatched ? sortedNotMatched[0] : X)

}

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