import kotlin.math.abs

fun main() = Thread(null, ::abc170c, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc170c() {
    val (x, n) = readLine()!!.split(' ').map { it.toInt() }
    val pList = if (n > 0) readLine()!!.split(' ').map { it.toInt() }.toSet() else emptySet()

    val list = (0..101).filter { it !in pList }
    val answer = list.minBy { abs(x - it) }

    println(answer)
}
