import qualified Control.Arrow as Arrow import qualified Control.Monad as Monad import qualified Data.Char as Char import qualified Data.List as List import qualified Data.ByteString.Char8 as BSC8 import qualified Data.Vector.Unboxed as VU import qualified Data.Ord as Ord getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString) getI = fmap (Arrow.second BSC8.tail) . BSC8.readInt getAB :: IO (Int, Int) getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getI <$> BSC8.getLine main :: IO () main = do (n, k) <- getAB s <- BSC8.unpack <$> BSC8.getLine if even (n - k) then solve' n k s else solve'' n k s solve', solve'' :: Int -> Int -> String -> IO () solve' n k s = let xs = [k, k + 1 .. n] ++ [k - 1, k - 2 .. 1] ys = zip xs s zs = List.sortBy (Ord.comparing fst) ys in putStrLn $ map snd zs solve'' n k s = let xs = [k, k + 1 .. n] ++ [1 .. k - 1] ys = zip xs s zs = List.sortBy (Ord.comparing fst) ys in putStrLn $ map snd zs