program lamps
  implicit none
  integer :: n, k, i, j, l, r
  integer, dimension(200001) :: a = 0, b = 0
  read(*,*) n, k
  read(*,*) a(1:n)
  do i = 1, k
    b(1:n) = 0
    do j = 1, n
      l = max(j-a(j),1)
      r = min(j+a(j),n)+1
      b(l) = b(l)+1
      b(r) = b(r)-1
    end do
    do j = 1, n
      b(j+1) = b(j+1)+b(j)
    end do
    if (all(b(1:n) == a(1:n))) exit
    a(1:n) = b(1:n)
  end do
  write(*,'(i0)',advance='no') a(1)
  do i = 2, n
    write(*,'(x,i0)',advance='no') a(i)
  end do
  write(*,*) 
end program lamps