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[] arr = new int[n]; long[][] answers = new long[n][31]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); answers[i][0] = arr[i]; } for (int i = 1; i < 31; i++) { for (int j = 0; j < n; j++) { answers[j][i] = answers[j][i - 1] + answers[(int)((j + answers[j][i - 1]) % n)][i - 1]; } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { int x = k; long ans = i; for (int j = 30; j >= 0; j--) { if (x >= (1 << j)) { ans += answers[(int)(ans % n)][j]; x -= (1 << j); } } ans++; sb.append(ans).append("\n"); } System.out.print(sb); } }