12666 - Hunter Likes Cypher   

Description

"Bieh Ji Jhe Shuo Ni Ai Wo Dao Tian Chang Di Jiou ~~~"

Hunter likes to dance, and joined the nthu pop dance club.

One day he asked Jeff , Joshua , Bena , Ricky ... to form a circle to cypher, they used to spin a bottle to determine who is the next one.

But today they want to do it in another way, they count from 0th member M times, so the (M-1)th member solos, when he/she finishes, he/she will be removed from the circle, and count from mth person m times again...

Until every members have soloed.

Now Hunter wanna know the solo's order, can you help him?

Input

There will be multiple testcases in each input file, but no more than 10

Two integer N, M, in first line, N means the numbers of members in the circle. 

And N integers Ai in the second line which means the index of ith member , 0 <= i < N , 0 <= Ai < N

1 <= N <= 5000
1 <= M <= 10000000

You should do it in fast way, or you will get time limits exceeded​ in last three testcases.

Output

Output the solo's order.

Sample Input  Download

Sample Output  Download

Tags




Discuss