program sample
    implicit none
  
    integer(8) :: i,j,m,n,k,a,b,l
    
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,k
    allocate(x(n))
    allocate(y(n))
    read(*,*)x
   
    do i=1,k
        y=0
        do j=1,n
            a=x(j)
            if (a>0)then

                do l=1,a
                    if (j+l<=n)then
                    y(j+l)=y(j+l)+1
                    end if
                    if(j-l>=1)then
                    y(j-l)=y(j-l)+1
                    end if
                end do
            end if

        end do
        x=y
        
    end do

    write(*,*) y
  
    stop
end program sample
  

