#include using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep_up(i, a, b) for (ll i = a; i < b; ++i) #define rep_down(i, a, b) for (ll i = a; i > b; --i) #define P pair #define Graph vector> #define fi first #define se second #define vvvvll vector>>> #define vvvll vector>> #define vvll vector> #define vll vector #define vvvvdo vector>>> #define vvvdo vector>> #define vvdo vector> #define vdo vector #define pqll priority_queue #define pqllg priority_queue, greater> constexpr ll INF = (1ll << 60); // constexpr ll mod = 998244353; constexpr ll mod = 1000000007; // constexpr ll mod = 67280421310721; constexpr double pi = 3.14159265358979323846; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } void pt_vvll(vvll v) { ll vs = v.size(), vs0 = v[0].size(); rep(i, vs) { rep(j, vs0) { if (v[i][j] != INF) cout << v[i][j]; else cout << -1; if (j != vs0 - 1) cout << " "; else cout << "\n"; } } } void pt_vll(vll v) { ll vs = v.size(); rep(i, vs) { cout << v[i]; if (i == vs - 1) cout << "\n"; else cout << " "; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, K; cin >> N >> K; vll A(N); rep(i, N) cin >> A[i]; vvll db(60, vll(N)); rep(i, N) db[0][i] = i + A[i]; // db[k][i] := iから2^k回操作してたどり着く番号 rep(jump, 59) { rep(now, N) { db[jump + 1][now] = db[jump][db[jump][now] % N] + (db[jump][now] / N) * N; } } rep(i, N) { ll now = i, see = K; for (ll jump = 0; see > 0; jump++) { if (see & 1) { now = db[jump][now % N] + (now / N) * N; } see = see >> 1; } cout << now + 1 << "\n"; } return 0; }