import Data.Maybe
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=putStrLn.solve.map(fst.fromJust.B.readInt).B.words=<<B.getContents
solve(n:k:as)=f k.V.fromList$as
f 0 as=unwords.map show.V.toList$as
f k as=f(if as==bs then 0 else k-1)bs where
  n=V.length as
  bs=V.scanl1(+).V.accum(+)(V.replicate n 0)$concatMap g.zip[0..].V.toList$as
  g(i,a)=(max 0$i-a,1):if i+a+1<n then [(i+a+1,-1)] else []