13843 - Yet Another Josephus Problem   

Description

You must be familiar with Josephus problem. In case your impression is faded, it’s a game that \(n\) people (say \(1,2,\dots,n\)) in a circle and in each round \(k\) people are repeatedly skipped and the next people is eliminated.

In this problem, we are curious about the order people eliminated.

Input

There would be two integers \(n,k\) in a line.

Constraints

\(1 \leq n \leq 10^4\)
\(0 \leq k \leq 10^9\)

Output

For each round, please print the order people eliminated. The order should be printed in a line, and there should be a space after each number.

DO NOT to print '\n' at the end of output.

Sample Input  Download

Sample Output  Download

Tags




Discuss