#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define NMAX 200001

int a[NMAX], up[NMAX], bt[NMAX];
int imos[NMAX];
char c[NMAX][30];
int clen[NMAX];

void reset(int n) {
    for(int i = 0; i < n; i++) imos[i] = 0;
}

int get_int() {
    int res = 0;
    char c = getchar();
    while(c != EOF && c != ' ' && c != '\n') {
        res *= 10;
        res += c - '0';
        c = getchar();
    }
    return res;
}

int get_int_array(int *a) {
    int res = 0;
    char *line;
    size_t len, itr = 0;
    int dump = getline(&line, &len, stdin);
    for(int i = 0; i < len; i++) {
        if(line[i] == ' ' || line[i] == '\n'){
            a[itr++] = res;
            res = 0;
        } else {
            res *= 10;
            res += line[i] - '0';
        }
    }
}

void put_int(int *a, int n) {
    for(int i = 0; i < n; i++) {
        int sz = 0;
        int m = a[i];
        c[i][sz++] = (m % 10) + '0';
        m /= 10;
        while(m > 0) {
            c[i][sz++] = (m % 10) + '0';
            m /= 10;
        }
        clen[i] = sz-1;
    }
    for(int j = 0; j < n; j++) {
        for(int i = clen[j]; i >= 0; i--) {
            putchar(c[j][i]);
        }
        putchar('\n');
    }
}

int max(int a, int b) { 
    if(a > b) return a;
    else return b;
}

int min(int a, int b) { 
    if(a < b) return a;
    else return b;
}

int main(){

    int n, k;
    n = get_int();
    k = get_int();
    //for(int i = 0; i < n; i++) a[i] = get_int();
    get_int_array(a);

    for(int itr = 0; itr < k; itr++) {
        reset(n+1); 
        for(int i = 0; i < n; i++) {
            if(i > a[i]) bt[i] = i - a[i];
            else bt[i] = 0;
            if(n < i + a[i] + 1) up[i] = n;
            else up[i] = i + a[i] + 1;
        }
        for(int i = 0; i < n; i++){
            imos[bt[i]]++;
            imos[up[i]]--;
        }
        int acc = 0;
        for(int i = 0; i < n; i++){
            acc += imos[i];
            a[i] = acc;
        }
        int sum = 0;
        for(int i = 0; i < n; i++) sum += a[i];
        if(sum == n * n) break;
    }

    //    for(int i = 0; i < n; i++) put_int(a[i]);
    put_int(a, n);
    return 0;
}
