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

int cmp(const void * n1, const void * n2){
  if(*(double *) n1 > *(double *) n2){
    return 1;
  }else if (*(double *) n1 < *(double *) n2){
    return -1;
  }else{
    return 0; 
  }
}
//目標値より大きい最初の子
int ika(const double arr[], int t, int fir, int las){
  //printf("%d %d %d\n", t, fir, las);
  if(fir+1 >= las){
    return t < arr[fir] ? fir : las;
  }
  int mid = (fir + las) / 2;
  if(arr[mid] <= t){
    return ika(arr, t, mid, las);
  }else{
    return ika(arr, t, fir, mid);
  }
}

//目標値以上の最初
int miman(const double arr[], int t, int fir, int las){
  if(fir+1 >= las){
    return t <= arr[fir] ? fir : las;
  }
  int mid = (fir + las) / 2;
  if(arr[mid] < t){
    return miman(arr, t, mid, las);
  }else{
    return miman(arr, t, fir, mid);
  }
}


int main(){
    int n,k;
    scanf("%d %d", &n, &k);
    int arr[n];
    double t1[n], t2[n];
    for(int i=0;i<n;i++)scanf("%d",&arr[i]);
  
    for(int i=0;i<k;i++){
      for(int j=0;j<n;j++){
        t1[j] = j - arr[j] - 0.5;
        t2[j] = j + arr[j] + 0.5;
      }
      qsort(t1, sizeof(t1)/sizeof(t1[0]), sizeof(double), cmp);
      qsort(t2, sizeof(t2)/sizeof(t2[0]), sizeof(double), cmp);

      /*for(int l=0;l<n;l++)printf("%f ",t1[l]);
      printf("\n");
      for(int l=0;l<n;l++)printf("%f ",t2[l]);
      printf("\n");
      */
        
      int tmp = 0;
      int k = 0;
      int h = 0;
      for(int j=0;j<n;j++){
        //printf("%d %d %d\n", j, k, n);
        k = ika(t1, j, k, n);
        //printf("%d %d %d\n", j, h, n);
        h = miman(t2, j, h, n);
        //printf("%d %d\n", k, h);
        arr[j] = k-h;
      }
    }
    for(int l=0;l<n;l++)printf("%d ",arr[l]);
    return 0;
}