We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i.  Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:    * For each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.  Find the intensity of each bulb after the K operations.
import copy
def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    
    for i in range(K):
        A_next = [0] * len(A)
        for i, a in enumerate(A):
            A_next[i] += 1
            for d in range(1, a+1):
                idx = i - d
                if idx >= 0 and idx < len(A_next):
                    A_next[idx] += 1

                idx = i + d
                if idx >= 0 and idx < len(A_next):
                    A_next[idx] += 1
        A = copy.deepcopy(A_next)

        if min(A) == N:
            break 

    print(A_next)

if __name__ == "__main__":
    resolve()
import copy
from functools import lru_cache
import numpy as np
from numba import njit




#     N = len(A)



#         r = min(i + A[i], N-1)
#         B[l] += 1
#         if r+1 < N:
#             B[r+1] -= 1


#     return B

def resolve():
    N, K = map(int, input().split())
    A = np.array(list(map(int, input().split())))

    # N = 2 * 10**5
    # K = 2 * 10**5
    # A = np.array([0] *  N)

    @njit
    def func(A):
        #N = len(A)
        B = np.zeros_like(A)
        for i in range(N):
            l = max(0, i - A[i])
            r = min(i + A[i], N-1)
            B[l] += 1
            if r+1 < N:
                B[r+1] -= 1

        B = np.cumsum(B)
        return B

    for k in range(K):
        #print(k)
        A = func(A)
        if k >= 50:
            break

    print(" ".join(map(str, A)))

if __name__ == "__main__":
    resolve()