import java.util.*
import java.math.*
import java.lang.Math.*

val readString: ()->String = {readLine()!!}
val readInt: ()->Int = {readLine()!!.toInt()}
val readLong: ()->Long = {readLine()!!.toLong()}
val readIntArray: ()->IntArray = {readLine()!!.split(' ').map{it.toInt()}.toIntArray()}
val readLongArray: ()->LongArray = {readLine()!!.split(' ').map{it.toLong()}.toLongArray()}
val errPrintln: (String)->Unit = {msg -> System.err.println(msg)}
val MOD = 1_000_000_007L
val INF = Int.MAX_VALUE/2
val LINF = Long.MAX_VALUE/2


fun solve(X: Int, P: IntArray): Int {
    var cand = ArrayList<Int>()
    for (i in 0..101) {
        if (P.contains(i)) continue
        else cand.add(i)
    }

    var res = 0
    var dist = INF
    for (c in cand) {
        if (dist > abs(c - X)) {
            dist = abs(c-X)
            res = c
        }
    }

    return res
}


fun main(args: Array<String>){
    val (X,N) = readIntArray()
    if (N == 0) {
        println(X)
        return
    }

    val P = readIntArray()

    val ans = solve(X, P)

    println(ans)
}
