{-# OPTIONS_GHC -Wall #-}

import Control.Monad
import Data.List

readInt :: String -> Int
readInt = read

riffle :: [Int] -> [Int]
riffle xs = (concat . transpose) [ys1,ys2]
    where
        (ys1,ys2) = splitAt (length xs `div` 2) xs

cut :: [Int] -> Int -> [Int]
cut xs k = ys2 ++ ys1
    where
        (ys1,ys2) = splitAt k xs

operate :: [Int] -> Int -> [Int]
operate xs 0 = riffle xs
operate xs k = cut xs k

main :: IO ()
main = do
    n   <- fmap readInt getLine
    m   <- fmap readInt getLine
    ops <- fmap (map readInt) $ replicateM m getLine

    let xs  = [1..2*n]
    let ans = foldl operate xs ops

    forM_ ans print

