import sys

import numpy as np

from numba import jit

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

N, K, *A = list(map(int, read().split()))

 

@jit

def imos(A):

  B = np.zeros_like(A)

  for i,x in enumerate(A):

    a = max(0,i-x)

    b = min(N-1,i+x)

    B[a] += 1

    if b+1 <= N-1:

      B[b+1] -= 1

  B = np.cumsum(B)

  return B

 

for i in range(K):

  if i >= 50:

    break

  A = imos(A)

print((*A))
import sys

import numpy as np

from numba import jit

 

readline = sys.stdin.readline

 

@jit

def loop(n,k,a):

    for j in range(k):

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

        for i in range(n):

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

            b[min(i+a[i]+1, n)] -= 1

        a = np.cumsum(b)[:-1]

        if np.all(a==n):

            return(a)

            break

    else:

        return(a)

 

 

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

a = np.array(readline().split(), dtype=np.int64)

 

ans = loop(n,k,a)

print((*ans))
import sys
import numpy as np
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = list(map(int, read().split()))


@jit
def imos(A):
    B = np.zeros_like(A)
    for i, x in enumerate(A):
        a = max(0, i - x)
        b = min(N - 1, i + x)
        B[a] += 1
        if b + 1 <= N - 1:
            B[b + 1] -= 1
    B = np.cumsum(B)
    return B


for i in range(K):
    if i >= 50:
        break
    A = imos(A)
print((*A))

import sys
import numpy as np
from numba import jit

readline = sys.stdin.readline


@jit
def loop(n, k, a):
    for j in range(k):
        b = np.zeros(n + 1, dtype=np.int64)
        for i in range(n):
            b[max(i - a[i], 0)] += 1
            b[min(i + a[i] + 1, n)] -= 1
        a = np.cumsum(b)[:-1]
        if np.all(a == n):
            return a
            break
    else:
        return a


n, k = list(map(int, readline().split()))
a = np.array(readline().split(), dtype=np.int64)
ans = loop(n, k, a)
print((*ans))

-read = sys.stdin.buffer.read -readline = sys.stdin.buffer.readline -readlines = sys.stdin.buffer.readlines -N, K, *A = list(map(int, read().split())) +readline = sys.stdin.readline -def imos(A): -    B = np.zeros_like(A) -    for i, x in enumerate(A): -        a = max(0, i - x) -        b = min(N - 1, i + x) -        B[a] += 1 -        if b + 1 <= N - 1: -            B[b + 1] -= 1 -    B = np.cumsum(B) -    return B +def loop(n, k, a): +    for j in range(k): +        b = np.zeros(n + 1, dtype=np.int64) +        for i in range(n): +            b[max(i - a[i], 0)] += 1 +            b[min(i + a[i] + 1, n)] -= 1 +        a = np.cumsum(b)[:-1] +        if np.all(a == n): +            return a +            break +    else: +        return a -for i in range(K): -    if i >= 50: -        break -    A = imos(A) -print((*A)) +n, k = list(map(int, readline().split())) +a = np.array(readline().split(), dtype=np.int64) +ans = loop(n, k, a) +print((*ans))