import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] permulation = new int[n]; int[] base = new int[n]; for (int i = 0; i < n; i++) { permulation[i] = sc.nextInt(); base[i] = i; } int[][] idxes = new int[31][n]; int[][] counts = new int[31][n]; for (int i = 0; i < n; i++) { idxes[0][i] = (i + permulation[i]) % n; if (i + permulation[i] >= n) { counts[0][i] = 1; } } for (int i = 1; i < 31; i++) { for (int j = 0; j < n; j++) { idxes[i][j] = idxes[i - 1][idxes[i - 1][j]]; counts[i][j] = counts[i - 1][j] + counts[i - 1][idxes[i - 1][j]]; } } long[] add = new long[n]; for (int i = 30; i >= 0; i--) { if (k >= (1 << i)) { k -= (1 << i); for (int j = 0; j < n; j++) { add[j] += counts[i][base[j]]; base[j] = idxes[i][base[j]]; } } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { sb.append(add[i] * n + base[i] + 1).append("\n"); } System.out.print(sb); } }