#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define vi vector<long long>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less   
using namespace __gnu_pbds;  
using namespace std;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> set1;
ll mod=1000000007;
ll large=1e18;
ll neg=-1e18;
ll N=500000;
ll mod1=998244353;
struct pii
{
   ll x;
   ll y;
};
struct edge
{
   ll from;
   ll to;
   ll w;
   ll id;
};
ll find(ll a,ll p[])
{
   //cout<<"find "<<a<<endl;
   if(a==p[a])
   return a;
   else return p[a]=find(p[a],p);

}
void join(ll a,ll b,ll p[],ll sz[])
{
   a=find(a,p);
   b=find(b,p);
   if(a!=b)
   {
      if(sz[a]<sz[b])
      swap(a,b);
      sz[a]+=sz[b];
      p[b]=a;
   }
}
ll power(ll a,ll b,ll mod)
{
   ll res=1;
   while(b>0)
   {
      if(b&1)
      res=(res*a)%mod;
      b=b/2;
      a=(a*a)%mod;
   }
   return res;
}
ll inverse(ll x, ll p)
{
   return power(x,p-2,p);
}
ll hash1(ll x,ll y)
{
   return x+y+x*y;
}
/*ll f[200000]={0};

void ini()
{
   f[0]=1;
   for(ll i=1;i<=200000;i++)
   f[i]=(i*f[i-1])%mod;
}*/
void build(ll tree[],ll v,ll l,ll r,ll dp[])
{
   if(l==r)
      tree[v]=dp[l];
   else
   {
      ll m=(l+r)/2;
      build(tree,2*v,l,m,dp);
      build(tree,2*v+1,m+1,r,dp);
      tree[v]=max(tree[2*v],tree[2*v+1]);
   }
}
ll query(ll tree[],ll v,ll l,ll r,ll tl,ll tr)
{
   if(l==tl && tr==r)
   {
    //  cout<<"max of "<<tl<<" "<<tr<<" "<<tree[v]<<endl;
      return tree[v];
   }
   else
   {
      ll m=(l+r)/2;
      if(tr<=m)
      {
         ll z1= query(tree,2*v,l,m,tl,tr);
     //    cout<<"max of "<<tl<<" "<<tr<<" "<<z1<<endl;
         return z1;
      }
      else if(tl>m)
      {
         ll z2= query(tree,2*v+1,m+1,r,tl,tr);
      //   cout<<"max of "<<tl<<" "<<tr<<" "<<z2<<endl;
         return z2;
      }
      else 
      {
         ll z=query(tree,2*v,l,m,tl,m);
         ll z1=query(tree,2*v+1,m+1,r,m+1,tr);
       //  cout<<"max of "<<tl<<" "<<tr<<" "<<max(z1,z)<<endl;
         return max(z1,z);
      }
      
      
   }
}
void update(ll tree[],ll v,ll l,ll r,ll pos,ll element)
{
   if(l==r && l==pos)
   tree[v]=element;
   else
   {
      ll m=(l+r)/2;
      if(pos<=m)
      update(tree,2*v,l,m,pos,element);
      else
      update(tree,2*v+1,m+1,r,pos,element);
      tree[v]=max(tree[2*v],tree[2*v+1]);
   }
}

/*ll ncr(ll n,ll r)
{
   ll res=1;
   ll k=f[n];
   ll v=inverse(f[n-r],mod);
   ll u=inverse(f[r],mod);
   ll x=(u*v)%mod;
   k=(k*x)%mod;
   return k;
}*/
ll change(ll a[],ll n)
{
   ll res[n+1]={0};
   for(ll i=1;i<=n;i++)
   {
     for(ll j=max((ll)1,i-a[i]);j<=min(i+a[i],n);j++)
     {
         res[j]++;
     }
   }
   for(ll i=1;i<=n;i++)
   {a[i]=res[i];
      cout<<res[i]<<" ";
   }
   cout<<endl;
}
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
  ll n,k;
  cin>>n>>k;
  ll a[n+1];
  for(ll i=0;i<n;i++)
  cin>>a[i+1];
ll dp[n+1]={0};
ll z=1;
for(ll i=0;i<k;i++)
{
   ll dp[n+1]={0};
   z=1;
   for(ll j=1;j<=n;j++)
   {
      ll i1=j;
      ll r=min(i1+a[i1],n);
      ll l=max((ll)1,i1-a[i1]);
      dp[l]++;
      if(i1+a[i1]<n)
      dp[r+1]--;
   }
   //for(ll i1=1;i1<=n;i1++)
   //cout<<dp[i1]<<" ";
   //cout<<endl;

   for(ll j=1;j<=n;j++)
   {
      ll i1=j;
     
      if(i1!=1)
      a[i1]=dp[i1]+a[i1-1];
      else
      a[i1]=dp[i1];
   }
   for(ll j=1;j<=n;j++)
   {
      if(a[j]!=n)
      {
         z=0;
         break;
      }
   }
   
   if(z==1)
   break;

}
for(ll i=1;i<=n;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}

Measured memory_bytes: 8276