import java.util.Scanner

import scala.annotation.tailrec

object Main extends App {
  val sc = new Scanner(System.in)
  val X, N = sc.nextInt
  if (N == 0) {
    println(X)
  } else {
    val seq = (0 until N).foldLeft(Vector.fill(100)(true)) { (acc, _) =>
      val next = sc.nextInt - 1
      acc.updated(next, false)
    }.zipWithIndex
//    System.err.println(seq)

    @tailrec def loop(n: Int): Int = {
      val smaller = seq.take(X - n).last
//      System.err.println(s"smaller: $smaller")
      val larger = seq.drop(X - 1 + n).head
//      System.err.println(s"larger: $larger")
      if (smaller._1) smaller._2
      else if (larger._1) larger._2
      else loop(n + 1)
    }

    val ans = loop(0)
    println(ans + 1)
  }
}
