#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,k;cin>>n>>k; vcv(n); rep(i,n)cin>>v[i]; vcvr(n); rep(i,n)vr[i]=(i+v[i])%n; int t=30; vc vx(t,vc(n,0)); vc vy(t,vc(n,0)); vy[0]=v; vx[0]=vr; rep(i,t-1)rep(j,n)vx[i+1][j]=vx[i][vx[i][j]]; rep(i,t-1)rep(j,n)vy[i+1][j]=vy[i][j]+vy[i][vx[i][j]]; rep(i,n){ int a=i; ll ans=i; for(int j=t-1;j>=0;j--)if(k>>j&1){ ans+=vy[j][a]; a=vx[j][a]; } cout<