object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  
  val nums = inputs(0).split(" ").map(_.toInt)
  val n = nums(0)
  val k = nums(1)
  val lamps = inputs(1).split(" ").map(_.toInt)


  println(solve(n, k, lamps))

  private def solve(n: Int, k: Int, lamps: Seq[Int]): String = {
    var currentPower = lamps
    var nextPower    = Seq.fill(n)(0)
    val range = scala.collection.mutable.ArrayBuffer.fill(n)(0)

    (1 to k).foreach { _ =>
      (0 until n).foreach { i =>
        val power = currentPower(i)

        val left = Math.max(0, i - power)
        val right = Math.min(i + power, n)

        range.update(left,  range(left) + 1)
        range.update(right, range(right) - 1)
      }

      range.zipWithIndex.foldLeft(0){ case (acc, (v, i)) =>
        val a = acc + v
        range.update(i, a)
        a
      }

      nextPower = range.toSeq
      if (nextPower == currentPower) {
        return currentPower.mkString(" ")
      }

      currentPower = nextPower
    }
    currentPower.mkString(" ")
  }
}