Hide

Duck Pond

Suppose there are $n$ ducks floating on the pond in a circle. The pond is also home for an alligator with a fondness for ducks. Beginning at a particular position (duck number 1) the alligator counts around the circle and eats every $m$th duck (the circle closing as ducks are eaten). For example, when $n = 8$ and $m = 4$, the following diagram shows duck number outside each node and consumption order inside:

\includegraphics[scale=0.4]{duckpond.png}

The first duck is fifth on the menu, the second is fourth, etc. The sequence 5 4 6 1 3 8 7 2 or orders of consumption completely describes the alligator’s menu.

Input

Input consists of a single line containing two integers $n$ ($1 \leq n < 99$) and $m$ ($1 \leq m < 99$).

Output

Print out the orders of consumption of the ducks on a single line.

Sample Input 1 Sample Output 1
8 4
5 4 6 1 3 8 7 2

Please log in to submit a solution to this problem

Log in