import sys

from itertools import accumulate

input=sys.stdin.buffer.readline



def main():

    n, k = list(map(int, input().split()))

    A = [*list(map(int, input().split()))]

    

    # for _ in range(min(k,int(math.log(n,2)))):

    

    for _ in "_"*k:

        b=[0]*(n)

        

        for i,v in enumerate(A):

            if i>v:

            # b[max(0,i-v)]+=1

                b[i-v]+=1

            else:

                b[0]+=1

            j=i-~v

            # if i+v+1<n:

            #     b[i+v+1]-=1

            if j<n:

                b[j]-=1

        

        # update ans

        # cnt=0

        # for i in range(1,n):

        #     b[i]+=b[i-1]

        A=[*accumulate(b)]

        

        if min(A)==n:

            break

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



if '__main__' == __name__:

    main()
from numba import jit

import numpy as np





n, k = list(map(int, input().split()))

A = np.array([*list(map(int, input().split()))],dtype=np.int64)



# for _ in range(min(k,int(math.log(n,2)))):



@jit

def loop(A):

    for _ in range(k):

        b=np.zeros(n,dtype=np.int64)

        

        for i,v in enumerate(A):

            # if i>v:

            b[max(0,i-v)]+=1

                # b[i-v]+=1

            # else:

                # b[0]+=1

            # j=i-~v

            if i+v+1<n:

                b[i+v+1]-=1

            # if j<n:

            #     b[j]-=1

        

        # update ans

        # cnt=0

        # for i in range(1,n):

        #     b[i]+=b[i-1]

        A=np.cumsum(b)

        

        if min(A)==n:

            break

    return A

print((" ".join(map(str,loop(A)))))
import sys
from itertools import accumulate

input = sys.stdin.buffer.readline


def main():
    n, k = list(map(int, input().split()))
    A = [*list(map(int, input().split()))]
    # for _ in range(min(k,int(math.log(n,2)))):
    for _ in "_" * k:
        b = [0] * (n)
        for i, v in enumerate(A):
            if i > v:
                # b[max(0,i-v)]+=1
                b[i - v] += 1
            else:
                b[0] += 1
            j = i - ~v
            # if i+v+1<n:
            #     b[i+v+1]-=1
            if j < n:
                b[j] -= 1
        # update ans
        # cnt=0
        # for i in range(1,n):
        #     b[i]+=b[i-1]
        A = [*accumulate(b)]
        if min(A) == n:
            break
    print((" ".join(map(str, A))))


if "__main__" == __name__:
    main()

from numba import jit
import numpy as np

n, k = list(map(int, input().split()))
A = np.array([*list(map(int, input().split()))], dtype=np.int64)
# for _ in range(min(k,int(math.log(n,2)))):
@jit
def loop(A):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i, v in enumerate(A):
            # if i>v:
            b[max(0, i - v)] += 1
            # b[i-v]+=1
            # else:
            # b[0]+=1
            # j=i-~v
            if i + v + 1 < n:
                b[i + v + 1] -= 1
            # if j<n:
            #     b[j]-=1
        # update ans
        # cnt=0
        # for i in range(1,n):
        #     b[i]+=b[i-1]
        A = np.cumsum(b)
        if min(A) == n:
            break
    return A


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

-import sys -from itertools import accumulate +from numba import jit +import numpy as np -input = sys.stdin.buffer.readline - - -def main(): -    n, k = list(map(int, input().split())) -    A = [*list(map(int, input().split()))] -    # for _ in range(min(k,int(math.log(n,2)))): -    for _ in "_" * k: -        b = [0] * (n) +n, k = list(map(int, input().split())) +A = np.array([*list(map(int, input().split()))], dtype=np.int64) +# for _ in range(min(k,int(math.log(n,2)))): +@jit +def loop(A): +    for _ in range(k): +        b = np.zeros(n, dtype=np.int64) -            if i > v: -                # b[max(0,i-v)]+=1 -                b[i - v] += 1 -            else: -                b[0] += 1 -            j = i - ~v -            # if i+v+1<n: -            #     b[i+v+1]-=1 -            if j < n: -                b[j] -= 1 +            # if i>v: +            b[max(0, i - v)] += 1 +            # b[i-v]+=1 +            # else: +            # b[0]+=1 +            # j=i-~v +            if i + v + 1 < n: +                b[i + v + 1] -= 1 +            # if j<n: +            #     b[j]-=1 -        A = [*accumulate(b)] +        A = np.cumsum(b) -    print((" ".join(map(str, A)))) +    return A -if "__main__" == __name__: -    main() +print((" ".join(map(str, loop(A)))))