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 = VU.imap (\i a -> if (i >= j - p) && (i <= j + p) then (i, 1) else (i, 0)) as
  let as'' = VU.accumulate (+) as' ds
  if j /= n -1
    then cc as as'' (j + 1)
    else as''

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 (cc as base 0) n (k -1)
  where
    base = VU.generate n (\x -> 0)

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''))
