solve :: Int -> String -> String
solve w = map snd . filter (\a -> (fst a) `rem` w == 0) . zip [0..]

main :: IO ()
main = do
	str <- getLine
	dw <- getLine
	let w = (read dw) :: Int
	putStrLn (solve w str)