import kotlin.math.abs

fun main() {
    val builder = StringBuilder()

    val (x, n) = readInputLine().split(" ").map { it.toInt() }

    val set = mutableSetOf<Int>()

    val input = readInputLine()

    if (input.isNotEmpty()) {
        input.split(" ").map { set.add(it.toInt()) }
    }

    var maxDiff = Int.MAX_VALUE
    var ans = 0

    for (i in -200..200) {
        if (set.contains(i)) {
            continue
        }
        if (abs(x - i) < maxDiff) {
            maxDiff = abs(x - i)
            ans = i
        }
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
