import kotlin.math.abs

fun main(){
    val (x, n) = readLine()!!.split(" ").map { it.toInt() }
    if (n > 0){
        val p = readLine()!!.split(" ").map { it.toInt() }
        var min = 10000
        var ans = -1
        var flag = 0
        for (i in -100 until 200){
            if (min > abs(x - i)){
                for (j in 0 until n){
                    if (p[j] == i){
                        flag = 1
                        break
                    }
                }
                if (flag == 1){
                    flag = 0
                    continue
                } else {
                    min = abs(x - i)
                    ans = i
                }
            } else if (min == abs(x - i)){
                for (j in 0 until n){
                    if (p[j] == i){
                        flag = 1
                        break
                    }
                }
                if (flag == 1){
                    flag = 0
                    continue
                } else {
                    if (ans > i){
                        ans = i
                    }
                }

            }
        }
        println(ans)
    } else {
        println(x)
    }

}