import kotlin.math.abs

fun main() {
    val (X, N) = readLine()!!.split(" ").map { it.toInt() }
    if (N == 0) {
        println(X)
        return
    }
    
    val p = readLine()!!.split(" ").map { it.toInt() }.sortedBy { abs(X - it) }
    for (i in 0..100) {
        if (!p.contains(X - i)) {
            println(X - i)
            return
        } else if (!p.contains(X + i)) {
            println(X + i)
            return
        }
    }
}