import kotlin.math.abs

fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val (x: Int, n: Int) = line.split(" ").map {it.toInt()}
    val ps: List<Int> = if (n > 0) {
        val line2 = readLine()!!.trim()
        line2.split(" ").map {it.toInt()}.take(n)
    } else {
        listOf()
    }

    val pset = ps.toSet()
    var result: Int = 500
    var min: Int = 500
    for (j in (-101..201)) {
        if (!pset.contains(j)) {
            if (abs(x - j) < min) {
                result = j
                min = abs(x - j)
            }
        }
    }

    println("${result}")
}
