import java.util.*


fun main(args: Array<String>) {
    val (x, n) = getInts()
    val s = TreeSet<Int>().also {
        it.addAll((-1..101))
    }
    if (n != 0) {
        s.removeAll(getInts())
    }

    println(
    s.map { Math.abs(it - x) to it }
            .minBy { it.first }
            ?.second
    )
}


fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }