fun main() {
    val l = readLine()!!.split(' ').map { it.toInt() }
    val x = l[0]
    if (l[1] == 0) {
        println(x)
        return
    }
    val p = readLine()!!.split(' ').map { it.toInt() }.toHashSet()
    val q = (0..101)
    var def = 100
    var res = 0
    for (i in q) {
        if (!p.contains(i)) {
            var tmp = Math.max(x-i, i-x)
            if (def > tmp) {
                def = tmp
                res = i
            }
        }
    }
    println(res)
}
