fun main() {
  val (x, n) = readLine()!!.split(" ").map(String::toInt)
  var p = listOf<Int>()
  if(n!=0) p = readLine()!!.split(" ").map(String::toInt).toList()
  
  if(!p.contains(x)){
    println(x)
    return
  }
  
  for (i in 1 until 100) {
    if (!p.contains(x-i)){
      println(x-i)
      return
    }
    if (!p.contains(x+i)) {
      println(x+i)
      return
    }
  }
}