import numpy as np

from numba import njit





@njit

def myfunc(n, k, A):

    for _ in range(k):

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

        for i, a in enumerate(A[:-1]):

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

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

        A = np.cumsum(l)

        if np.all(A[:-1] == n):

            break

    return A





def main():

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

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

    A = np.append(A, 0)

    print((*myfunc(n, k, A)[:-1]))





if __name__ == "__main__":

    main()
import numpy as np

from numba import jit, i8





@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)

def myfunc(n, k, A):

    for _ in range(k):

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

        for i, a in enumerate(A[:-1]):

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

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

        A = np.cumsum(l)

        if np.all(A[:-1] == n):

            break

    return A





def main():

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

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

    A = np.append(A, 0)

    print((*myfunc(n, k, A)[:-1]))





if __name__ == "__main__":

    main()
import numpy as np
from numba import njit


@njit
def myfunc(n, k, A):
    for _ in range(k):
        l = np.zeros((n + 1,), dtype=np.int64)
        for i, a in enumerate(A[:-1]):
            l[max(0, i - a)] += 1
            l[min(n, i + a + 1)] -= 1
        A = np.cumsum(l)
        if np.all(A[:-1] == n):
            break
    return A


def main():
    n, k = list(map(int, input().split()))
    A = np.array(list(map(int, input().split())), dtype=np.int64)
    A = np.append(A, 0)
    print((*myfunc(n, k, A)[:-1]))


if __name__ == "__main__":
    main()

import numpy as np
from numba import jit, i8


@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)
def myfunc(n, k, A):
    for _ in range(k):
        l = np.zeros((n + 1,), dtype=np.int64)
        for i, a in enumerate(A[:-1]):
            l[max(0, i - a)] += 1
            l[min(n, i + a + 1)] -= 1
        A = np.cumsum(l)
        if np.all(A[:-1] == n):
            break
    return A


def main():
    n, k = list(map(int, input().split()))
    A = np.array(list(map(int, input().split())), dtype=np.int64)
    A = np.append(A, 0)
    print((*myfunc(n, k, A)[:-1]))


if __name__ == "__main__":
    main()

-from numba import njit +from numba import jit, i8 -@njit +@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)