#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N, K = map(int, readline().split()) P = np.array(read().split(), np.int64) rng = np.arange(N, dtype=np.int64) X = np.arange(N) while K: if K & 1: X += P[X % N] K //= 2 P += P[(P + rng) % N] X += 1 print('\n'.join(X.astype(str)))