//#define _GLIBCXX_DEBUG #include using namespace std; #define endl '\n' #define lfs cout<= (ll)(n); i--) using ll = long long; using ld = long double; const ll MOD1 = 1e9+7; const ll MOD9 = 998244353; const ll INF = 1e18; using P = pair; templatebool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;} templatebool chmax(T1 &a,T2 b){if(avoid ans(bool x,T1 y,T2 z){if(x)cout<void debug(vector>&v,ll h,ll w){for(ll i=0;i&v,ll h,ll w){for(ll i=0;ivoid debug(vector&v,ll n){if(n!=0)cout<vector>vec(ll x, ll y, T w){vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} vectordx={1,-1,0,0,1,1,-1,-1};vectordy={0,0,1,-1,1,-1,1,-1}; templatevector make_v(size_t a,T b){return vector(a,b);} templateauto make_v(size_t a,Ts... ts){return vector(a,make_v(ts...));} templateostream &operator<<(ostream &os, const pair&p){return os << p.first << " " << p.second;} templateostream &operator<<(ostream &os, const vector &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;} //mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); template struct Doubling { const ll LOG = 45; vector> nxt; vector> sum; F f; T iden; Doubling(int sz, T iden,F &f):iden(iden),f(f) { nxt.assign(LOG, vector< int >(sz, -1)); sum.assign(LOG, vector< T >(sz, iden)); } void set_next(int k, int x){ nxt[0][k] = x; } void set_val(int k, T x){ sum[0][k] = x; } void build() { for(ll k = 0; k + 1 < LOG; k++) { for(ll i = 0; i < nxt[k].size(); i++) { if(nxt[k][i] == -1) nxt[k + 1][i] = -1; else{ nxt[k + 1][i] = nxt[k][nxt[k][i]]; sum[k + 1][i] = f(sum[k][i],sum[k][nxt[k][i]]); } } } } ll query(int k, ll t)//t個進んだ時のsum { T ret = iden; for(ll i = LOG - 1; i >= 0; i--) { if((t >> i) & 1){ ret = f(ret, sum[i][k]); k = nxt[i][k]; } } return ret; } }; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll res=0,buf=0; bool judge = true; ll n,k;cin>>n>>k; vectorp(n); rep(i,0,n)cin>>p[i]; auto f=[&](ll x,ll y){ return x+y; }; Doubling db(n,0,f); rep(i,0,n){ db.set_next(i,(i+p[i])%n); db.set_val(i,p[i]); } db.build(); rep(i,0,n)cout<