
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (x, n) = readIntList()
    if (n == 0) {
        println(x)
        return
    }
    val p = readIntList()
    val pSet = mutableSetOf<Int>()
    p.forEach { pSet.add(it) }

    for (d in 0..x) {
        listOf(-1, 1).forEach {
            val num = x + d * it
            if (num !in pSet) {
                println(num)
                return
            }
        }
    }
}
