program main
    implicit none
    integer n,k
    integer i,j,l, tau, sum
    integer, allocatable, dimension(:) :: a, b

    read(*,*) n, k
    allocate(a(n))
    allocate(b(n))
    read(*,*) a

    sum = 0
    do i = 1,n
        sum = sum + a(i)
    end do

    if (sum /= 0) then
        tau = 2*int(log(real(n))) + 10

        if(k > tau) then
            a = n
        else 
            do l = 1,k

                b = 0
                do i = 1,n
                    do j = i-a(i), i+a(i)
                        if(j >= 1 .and. j <= n) then
                            b(j) = b(j) + 1
                        end if
                    end do
                end do

                do i = 1,n
                    a(i) = b(i)
                end do

            end do
        end if

    else
        a = 0
    end if

    write(*,*) a

end program

