import kotlin.math.abs

fun main() {
    val (X, N) = readLine()?.split(" ")?.map { Integer.parseInt(it) } ?: return
    if (N == 0) {
        println(X)
        return
    }
    val p = readLine()?.split(" ")?.map { Integer.parseInt(it) }?.sorted() ?: return
    var frag: Boolean
    val num = intArrayOf(Integer.MAX_VALUE, 0)
    for (i in 0..p[p.size - 1]+1) {
        frag = true
        for (j in p) {
            if (j == i) {
                frag = false
                break
            }

        }
        if (frag) {
            if (abs(X - i) < num[0]) {
                num[0] = abs(X - i)
                num[1] = i
            }
        }
    }
    println(num[1])
}