Time limit
0.15s
Memory limit
128 MB
There are N people numbered from 1 to N sitting in a circle, and a positive integer K is given. Starting from person 1, repeatedly remove the K-th remaining person while counting around the circle. After a person is removed, continue counting from the next remaining person. The removal order of all N people is called the (N, K)-Josephus permutation.
Given N and K, output the (N, K)-Josephus permutation.
The first line contains two integers N and K separated by a space.
Output the Josephus permutation in the format <a1, a2, ..., aN>.