import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

cc :: VU.Vector Int -> VU.Vector Int -> Int -> VU.Vector Int
cc as as' j = do
  let n = VU.length as
  let p = as VU.! j
  let ds = [maximum [j - p, 0] .. minimum [j + p, n -1]]
  let ds' = zip ds (take (length ds) (repeat 1))
  let as'' = VU.accum (+) as' ds'
  if j /= n -1
    then cc as as'' (j + 1)
    else as''

calc :: VU.Vector Int -> VU.Vector Int
calc as = do
  let n = VU.length as
  let base = VU.generate n (\x -> 0)
  cc as base 0

judge :: VU.Vector Int -> Int -> Int -> VU.Vector Int
judge as n 0 = as
judge as n k
  | VU.all (== n) as = as
  | otherwise = judge (calc as) n (k -1)

main = do
  [n, k] <- getIntList
  as <- getIntList
  let as' = VU.fromList as
  let as'' = judge as' n k
  mapM_ putStr (map (\x -> show x ++ " ") (VU.toList as''))
