import Control.Monad (replicateM,mapM_)
import Data.Array (Array,listArray,(!),elems)
import Data.List (foldl')

type Cards = Array Int Int

main = do
    n <- readLn
    m <- readLn
    ks <- replicateM m readLn

    let
        cards = foldl' (shuffle n) (initCards n) ks

    mapM_ print (elems cards)

    where
    shuffle n cards 0 = riffle n cards
    shuffle n cards k = cut n k cards
        

initCards :: Int -> Cards
initCards n = listArray (1,2*n) [1,2..]

riffle :: Int -> Cards -> Cards
riffle n cards = listArray (1,2*n) (map (cards !) ixs)
    where
    ixs = concatMap (\i -> [i,n+i]) [1..n]

cut :: Int -> Int -> Cards -> Cards
cut n k cards = listArray (1,2*n) (map (cards !) ([k+1..2*n]++[1..k]))