import scala.io.StdIn.{readLine,readInt}

object Main {
  def cut(c:Array[Int],n:Int,k:Int) = {
    c.slice(k,2*n) ++ c.slice(0,k)
  }

  def rif(c:Array[Int],n:Int) = {
    val a = c.slice(0,n)
    val b = c.slice(n,n+n)
    (0 until 2*n).map{ i=> if(i%2==0) a(i/2) else b((i-1)/2) }.toArray
  }

  def main(args:Array[String]) = {
    val n = readInt
    val m = readInt
    var a = (0 until 2*n).map { i => i+1 }.toArray
    for(i<-0 until m) {
      val k = readInt
      if(k==0) a = rif(a,n)
      else a = cut(a,n,k)
    }
    println(a.mkString("\n"))
  }

}