Limits 1s, 512 MB

There are $N$ students in a queue with ID $1, 2, 3, ..., N$ respectively. Each student has some coins $C_1, C_2, C_3, ...., C_N$. Minimum coins required for buying a meal from the canteen is $M$.

  • Students are coming one after another. If $C_i \geq M$, the $i$'th student should buy a meal from the canteen. After buying the meal, he/she will leave the queue.
  • If $C_i < M$ then the student should go behind the queue and his/her coins will be increased by exactly $1$.

The above process will repeat till the queue is not empty. Find the sequence of leaving the queue of $N$ students.

Input

The first line contains an integer $T$ $\left(1 \leq T \leq 10^3\right)$, the number of test cases.

Then $T$ test cases follow $-$

The first line of each test case contains two integers $N$ $\left(1 \leq N \leq 10^6\right)$ and $M$ $\left(1 \leq M \leq 10^9\right)$. The second line of each test case contains $N$ integers $C_1, C_2 , C_3 , ...., C_N$ $\left( 1 \leq C_i \leq 10^9\right)$.

It is guaranteed that the sum of $N$ over all test cases does not exceed $10^6$.

Output

For each test case, on a separate line print $N$ integers, the ID of $N$ students according to the sequence they left the queue.

Sample

InputOutput
1
8 7
3 1 5 3 7 4 5 2
5 3 7 6 1 4 8 2

Submit

Login to submit.

Contributors

Statistics

76% Solution Ratio
ivanbrEarliest, Feb '21
steinumFastest, 0.0s
steinumLightest, 9.1 kB
shreasShortest, 393B
Toph uses cookies. By continuing you agree to our Cookie Policy.