object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datX, datN) = readLine.split(" ").map(_.toInt)
    val datP_ = readLine

    // early retrun in N = 0
    if (datN == 0) {
      println(datX)
      return
    }

    val datP = datP_.split(" ").map(_.toInt).toSet
    var flag = false
    var i = 0
    while (flag == false) {
      if (datP(datX - i) == false) {
        println(datX - i)
        flag = true
      }
      else if (datP(datX + i) == false) {
        println(datX + i)
        flag = true
      }
      i += 1
    }
  }
}
