program light
  implicit none
  integer :: n, k, i, j
  integer,allocatable :: a(:), a2(:)

  read(*,*) n, k
  allocate(a(n),a2(n))
  read(*,*) a
  a2 = 0
  do i = 1, k
     do j = 1, n
        a2(max(1,j-a(j)):min(j+a(j),n))= a2(max(1,j-a(j)):min(j+a(j),n)) + 1
     end do
     a = a2
     a2 = 0
     if (minval(a)==n) then
        exit
     end if
  end do
  write(*,'(200000(i0,x))') a
  deallocate(a,a2)
  stop
end program light
