Problem:
Score : 500 points

Problem Statement

We have N bulbs arranged on a number line, numbered 1 to N from left to right.
Bulb i is at coordinate i.

Each bulb has a non-negative integer parameter called intensity.
When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.
Initially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:

For each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.

Find the intensity of each bulb after the K operations.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq 2 \times 10^5

0 \leq A_i \leq N

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \ldots A_N

Output

Print the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:

A{'}_1 A{'}_2 \ldots A{'}_N

Sample Input 1

5 1
1 0 0 1 0

Sample Output 1

1 2 2 1 2

Initially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.
Similarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.

Sample Input 2

5 2
1 0 0 1 0

Sample Output 2

3 3 4 4 3

Solution in C++ (GCC 9.2.1) (judge verdict: Time Limit Exceeded)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
//#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


/*
// 遅延セグ木

ll segnodenum;
vector<ll> segnode;
vector<ll> seglazy;

ll init_num=0;
ll func(ll x,ll y){
    return x+y;
}

void eval(ll k){    //seglazy[k]の遅延評価
    if(seglazy[k]==init_num)return;
    if(k<segnodenum-1){  //葉でなければ子に伝搬
        seglazy[2*k+1]=seglazy[k]/2;
        seglazy[2*k+2]=seglazy[k]/2;
    }
    //自分を更新
    segnode[k]+=seglazy[k];
    seglazy[k]=init_num;
}

void init(vector<ll> v){
    segnodenum=1;
    while(v.size()>segnodenum)segnodenum*=2;
    segnode.resize(2*segnodenum-1,init_num);
    seglazy.resize(2*segnodenum-1,init_num);
    rep(i,segnodenum-1,segnodenum*2-2){
        if(i-(segnodenum-1)<v.size()){
            segnode[i]=segnode[i-(segnodenum-1)];
        }else{
            segnode[i]=init_num;
        }
    }
    for(ll i=segnodenum-2;i>=0;i--){
        segnode[i]=func(segnode[2*i+1],segnode[2*i+2]);
    }
}


void update(ll i,ll j,ll x,ll k,ll l,ll r){
    eval(k);
    if(i<=l && r<=j) {  // 完全に内側の時
        seglazy[k]+= (r-l)*x;
        eval(k);
    }else if(i<r && l<j){                     // 一部区間が被る時
        update(i,j,x,k*2+1,l,(l+r)/2);  // 左の子
        update(i,j,x,k*2+2,(l+r)/2,r);  // 右の子
        segnode[k]=func(segnode[k*2+1],segnode[k*2+2]);
    }
}

void update(ll i,ll j,ll x){    //v[[i,j)]をxにupdate //[i,j)であることに注意
    update(i,j,x,0,0,segnodenum);
}

ll find(ll i,ll j,ll x,ll y,ll z){  //segnode[x]着目//segnode[x]が担当する範囲が[y,z)
    eval(x);
    if(j<=y || z<=i)return init_num;
    if(i<=y && z<=j)return segnode[x];
    return func(find(i,j,2*x+1,y,(y+z)/2),find(i,j,2*x+2,(y+z)/2,z));
}
ll find(ll i,ll j){             //v[[i,j)]でのfunc結果出力//[i,j)であることに注意
    return find(i,j,0,0,segnodenum);
}


*/

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};

int main(){fastio
    
    ll n,k;cin>>n>>k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll c=0;
    vector<ll> v;
    while(true){
        bool bol=true;
        rep(i,0,n-1){
            if(a[i]>=max(i,n-1-i)){
                
            }else{
                bol=false;
            }
        }
        if(bol){
            break;
        }
        
        
        LazySegmentTree seg( vector<ll>(n, 0) );
        rep(i,0,n-1){
            seg.add(max(0,i-a[i]),min(n-1,i+a[i])+1,1);
        }
        
        rep(i,0,n-1){
            a[i]=seg.getsum(i,i+1);
        }
        
        c++;
        if(c==k)break;
    }
    if(c==k){
        rep(i,0,n-1){
            cout<<a[i];
            if(i==n-1){
                cout<<endl;
            }else{
                cout<<' ';
            }
        }
    }else{
        rep(i,0,n-1){
            cout<<n;
            if(i==n-1){
                cout<<endl;
            }else{
                cout<<' ';
            }
        }
    }
    /*
    ll n=100000;
    cout<<n<<' '<<1<<endl;
    cout<<1<<' ';
    rep(i,1,n-1){
        cout<<0<<' ';
    }
    cout<<endl;
    */
    return 0;
}