main = do
    s <- getLine
    w <- readLn
    let zippedS = zip s [0,1..]
    putStrLn $ map fst $ reverse $ f zippedS w
    
f zippedS w = 
    foldl (\acc x -> if ((snd x) `mod` w == 0) then x:acc else acc)   
    []
    zippedS
