#pragma GCC optimze("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// inbuilt function in c++
// abs(-2)=2 , __gcd(2,3)=1 , swap(a,b) , 
//string/array s = "aba"; sort(s.begin(), s.end());  do {  cout << s << '\n';  } while(next_permutation(s.begin(), s.end()));  
//for all permutation of s.
#include <bits/stdc++.h>
#define int                 long long int
#define double              long double
#define get(a,n)            for(int i=0;i<n;i++){cin>>a[i];}
#define out(a,n)            for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define maxm(a)             int maxi=LLONG_MIN;int index;for(int i=0;i<n;i++){if(maxi<a[i]){maxi=a[i];index=i;}}
#define minm(a)             int mini=LLONG_MAX;int index;for(int i=0;i<n;i++){if(mini>a[i]){mini=a[i];index=i;}}
#define db(x)               cout<<x<<" "<<endl;
#define endl                "\n"
#define PI                  acos(-1)
#define half(a)             a%2?cout<<(a/2+1)<<endl:cout<<a/2<<endl;
#define array               int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define pb(a)                push_back(a)
#define all(a)              a.begin(),a.end()
using namespace std;
void show(int *a)
{
    int size = (*(&a + 1) - a)-1;
    for(int i=0;i<size;i++)
    {
            cout<<a[i]<<" ";
    }   
    cout<<endl;
}
int binary_search(int *a,int n,int e)
{
    int f,l,m;f=0;l=n-1;
    while(f<=l)
    {//returns index of that value.
        m=(f+l)/2;
        if(e==a[m])
            return(m);
        else if(e>a[m])
                f=m+1;
            else
                l=m-1;
    }
    return -1;
}
vector<int> pf;
void primefactors(int n)  
{  
    while (n % 2 == 0)  
    pf.push_back(2),n = n/2;  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        while (n % i == 0)  
        {  
            pf.push_back(i); 
            n = n/i;  
        }  
    }  
    if (n > 2)  
        pf.push_back(n);
        //dont forgot to clear pf vector. 
}  
vector<int> fac;
//vector<int,greater<int>>fac;
void factors(int n) 
{ 
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
            fac.push_back(i);
            else
            fac.push_back(i),fac.push_back(n/i); 
        } 
    } 
    //dont forgot to clear fac vector.
} 
// priority_queue stores the values in descending order q.front() returns maximum element. ".size() works for priority_queue."
signed main() {
 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        int a[n];
        
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
           
        }
        while(k--)
        {
            int b[n+1]={0};
            
            
            for(int i=0;i<n;i++)
            {
                int l=0,r=n-1;
                l=max(l,i-a[i]);
                r=min(r,i+a[i]);
               // db1(l);
              //  db1(r);
                b[l]++;
                b[r+1]--;
            }
            int mival=INT_MAX;
            a[0]=b[0];
            for(int i=1;i<n;i++)
            {
                b[i]=b[i]+b[i-1];
                a[i]=b[i];
                mival=min(a[i],mival);
            }
            if(mival==n)
            break;
        }
        for(int i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
     
      
    }
   

   
}
   

  


Measured memory_bytes: 6816