import sys

input=sys.stdin.readline

def main():

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

    a=list(map(int,input().split()))

    zeros=[0]*n



    if min(a)==n:

        print((*a))

        exit()



    for i in range(k):

        x=zeros.copy()

        for j in range(n):

            if a[j]==0:

                l=j

                r=min(j+1,n)

                #print(l,r)

                x[l]+=1

                if r!=n:

                #print(r)

                    x[r]+=-1

                #print(x)

            else:

                l=max(0,j-a[j])

                r=min(j+a[j]+1,n)

                #print(l,r)

                x[l]+=1

                if r!=n:

                    #print(r)

                    x[r]+=-1

                #print(x)

        ruiseki=[0]*n

        ruiseki[0]=x[0]

        a[0]=ruiseki[0]

        for i in range(1,n):

            ruiseki[i]=ruiseki[i-1]+x[i]

            a[i]=ruiseki[i]

        if min(a)==n:

            print((*a))

            exit()

 

        #print(*ruiseki)

    print((*a))

if __name__=="__main__":

    main()

import sys

input=sys.stdin.readline

def main():

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

    a=list(map(int,input().split()))

    zeros=[0]*n



    if min(a)==n:

        print((*a))

        exit()



    for i in range(k):

        x=zeros.copy()

        for j in range(n):



        

            l=max(0,j-a[j])

            r=min(j+a[j]+1,n)

            #print(l,r)

            x[l]+=1

            if r!=n:

                #print(r)

                x[r]+=-1

            #print(x)

        ruiseki=[0]*n

        ruiseki[0]=x[0]

        a[0]=ruiseki[0]

        for i in range(1,n):

            ruiseki[i]=ruiseki[i-1]+x[i]

            a[i]=ruiseki[i]

        if min(a)==n:

            print((*a))

            exit()

 

        #print(*ruiseki)

    print((*a))

if __name__=="__main__":

    main()
import sys

input = sys.stdin.readline


def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    zeros = [0] * n
    if min(a) == n:
        print((*a))
        exit()
    for i in range(k):
        x = zeros.copy()
        for j in range(n):
            if a[j] == 0:
                l = j
                r = min(j + 1, n)
                # print(l,r)
                x[l] += 1
                if r != n:
                    # print(r)
                    x[r] += -1
                # print(x)
            else:
                l = max(0, j - a[j])
                r = min(j + a[j] + 1, n)
                # print(l,r)
                x[l] += 1
                if r != n:
                    # print(r)
                    x[r] += -1
                # print(x)
        ruiseki = [0] * n
        ruiseki[0] = x[0]
        a[0] = ruiseki[0]
        for i in range(1, n):
            ruiseki[i] = ruiseki[i - 1] + x[i]
            a[i] = ruiseki[i]
        if min(a) == n:
            print((*a))
            exit()
        # print(*ruiseki)
    print((*a))


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline


def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    zeros = [0] * n
    if min(a) == n:
        print((*a))
        exit()
    for i in range(k):
        x = zeros.copy()
        for j in range(n):
            l = max(0, j - a[j])
            r = min(j + a[j] + 1, n)
            # print(l,r)
            x[l] += 1
            if r != n:
                # print(r)
                x[r] += -1
            # print(x)
        ruiseki = [0] * n
        ruiseki[0] = x[0]
        a[0] = ruiseki[0]
        for i in range(1, n):
            ruiseki[i] = ruiseki[i - 1] + x[i]
            a[i] = ruiseki[i]
        if min(a) == n:
            print((*a))
            exit()
        # print(*ruiseki)
    print((*a))


if __name__ == "__main__":
    main()

-            if a[j] == 0: -                l = j -                r = min(j + 1, n) -                # print(l,r) -                x[l] += 1 -                if r != n: -                    # print(r) -                    x[r] += -1 -                # print(x) -            else: -                l = max(0, j - a[j]) -                r = min(j + a[j] + 1, n) -                # print(l,r) -                x[l] += 1 -                if r != n: -                    # print(r) -                    x[r] += -1 -                # print(x) +            l = max(0, j - a[j]) +            r = min(j + a[j] + 1, n) +            # print(l,r) +            x[l] += 1 +            if r != n: +                # print(r) +                x[r] += -1 +            # print(x)