G. Josephus Problem 2
time limit per test
5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Are you familiar with the Josephus problem? To put it simply, imagine $$$n$$$ people standing in a circle, numbered from $$$1$$$ to $$$n$$$ in a clockwise order. A counting process begins with person $$$1$$$, and every $$$k$$$-th person in the clockwise direction is eliminated from the circle. After a person is eliminated, the counting resumes from the next person still in the circle. This process continues until only one person remains. The primary question is: who will be the last person remaining?

Mathematician Little J has already solved this problem, but he's now interested in a variation. He wants to determine the order in which individuals are eliminated if each person has a specific number of lives, denoted by $$$a_i$$$. In this scenario, the $$$k$$$-th person in the clockwise direction loses one life each time they are selected, and they are removed from the circle only when their life count reaches zero.

Input

The first line contains two positive integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 5 \times 10^4$$$, $$$1 \le k \le 100$$$).

The second line contains $$$n$$$ positive integers $$$a_i$$$ ($$$1 \le a_i \le 10^9$$$), representing the number of lives each person has.

Output

Output a permutation of the integers from $$$1$$$ to $$$n$$$ in $$$n$$$ lines, representing the order in which people are removed.

Example
Input
5 2
5 5 5 7 6
Output
2
1
3
5
4