import java.lang.Math.abs
import java.lang.Math.sqrt

fun main(args: Array<String>) {
    val (x, n) = readIntList()
    if (n == 0) {
        println(x)
        return
    }
    val p = readIntList()
    val notP = (0..101).map { it }.subtract(p)

    var ans = Int.MAX_VALUE
    var min = Int.MAX_VALUE
    notP.forEach {
        if (abs(it - x) < min) {
            min = abs(it - x)
            ans = it
        }
    }
    println(ans)
}


// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)