import scala.math._
import scala.collection.mutable.ListBuffer

object Main {
  //rt.gc()??§??¬??????????????¬?????????????????????
  //val rt = Runtime.getRuntime()
  val sc = new java.util.Scanner(System.in)
  def cutByK(c: List[Int], k: Int) = {
    c.drop(k) ::: c.take(k)
  }
  def riffle(c: List[Int]):List[Int] = c match {
    case Nil => Nil
    case _ => {
      val r = c.drop(c.size/2)
      c.head :: r.head :: riffle(c.take(c.size/2).tail ::: r.tail)
    }
  }
  def main(args: Array[String]) {
    val n = sc.nextInt
    val m = sc.nextInt
    var ans = (1 to 2*n).toList
    for(_ <- 1 to m) {
      val op = sc.nextInt
      if(op == 0) {
        ans = riffle(ans)
      } else {
        ans = cutByK(ans, op)
      }
    }
    ans.foreach(println)
  }
}