fun main(args: Array<String>) {
    val (x, n) = readLine()!!.split(' ').map(String::toLong)
    if(n==0L){
        println(x)
        return
    }
    val pList = readLine()!!.split(' ').map(String::toLong)

    for(i in 0..100){
        if(pList.contains(x-i).not()){
            println(x-i)
            return
        }
        if(pList.contains(x+i).not()){
            println(x+i)
            return
        }

    }
}
