import Control.Monad

main :: IO ()
main = do
  n <- readLn
  m <- readLn
  ls <- replicateM m readLn
  mapM_ print $ solve [1..n*2] ls n

solve :: [Int] -> [Int] -> Int -> [Int]
solve deck [] _ = deck
solve deck (x:xs) n
  | x == 0 = solve (riffle deck) xs n
  | otherwise = solve (kCut x deck) xs n
  where
    riffle :: [Int] -> [Int]
    riffle deck = alter (take n deck) (takeOther n deck)
      where
        alter :: [Int] -> [Int] -> [Int]
        alter [] [] = []
        alter (x:xs) (y:ys)= x:y:(alter xs ys)
    kCut :: Int -> [Int] -> [Int]
    kCut x deck = (takeOther x deck) ++ (take x deck)
    takeOther :: Int -> [Int] -> [Int]
    takeOther 0 xs = xs
    takeOther n (x:xs) = takeOther (n-1) xs