fun main() {
    val XN = readLine()!!.split(" ").map { it.toInt() }
    val X = XN[0]
    val N = XN[1]
    var answer = 0
    if (N > 0) {
        val ps = readLine()!!.split(" ").map { it.toInt() }
        for (i in 0..101) {
            if (!ps.contains(X - i)) {
                answer = X - i
                break
            } else if (!ps.contains(X + i)) {
                answer = X + i
                break
            }
        }
    } else {
        val b= readLine()!!
        answer = X
    }

    println(answer)
}