program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,k,i,j,l,r,jj
    integer(int64), allocatable:: a(:), na(:),ims(:)
    logical:: same

    read*, n,k
    allocate(a(n), na(0:n),ims(n))
    read*, a(:)
    ! a(:) = 0
    ! a(1) = 1

    if (k >= 50) then
        a(:) = n
        print'(*(i0,1x))', a(:)
        stop
    end if

    do i=1,k
        na(:) = 0
        ims(:) = 0
        same = .true.
        do j=1,n

            l = max(j-a(j),1_8)
            r = (j+a(j)+1)
            ! print'(*(i0,1x))', j,l,r
            ims(l)=ims(l)+1
            if (r <= n) ims(r)=ims(r)-1
        end do
        ! print'(*(i0,1x))', ims(:)
        do j=1,n
            na(j) = na(j-1)+ims(j)
        end do

        do j=1,n
            if (na(j) /= a(j)) same = .false.
        end do
        if (same) exit
        a(:) = na(1:)
    end do
    ! print'(i0)', i
    print'(*(i0,1x))', na(1:)
end program main