program answer
  implicit none

  integer :: N, K, i, j, count, s
  integer, allocatable :: A(:), B(:)

  read(*,*) N, K
  allocate(A(N))
  allocate(B(N))
  read(*,*) A

  count = 0
  do s = 1, K
  do i = 1, N
     do j = 1, N
        if(j-A(j)-0.5_8<=i.and.i<=j+A(j)+0.5_8) then
           count = count + 1
        end if
     end do
     B(i) = count
     count = 0
  end do
  A = B
  end do

  write(*,*) B

  deallocate(A)
  deallocate(B)
  stop
 end program answer
  