Time limit
2s
Memory limit
256 MB
N people numbered from 1 to N sit in a circle. Given a positive integer K, repeatedly remove the K-th remaining person while counting around the circle. After a person is removed, counting resumes from the next remaining person. The order in which all people are removed is called the (N, K)-Josephus permutation.
Given N and K, print the (N, K)-Josephus permutation.
The first line contains N and K separated by a space.
Print the removed numbers in order, enclosed in angle brackets < and >. Separate adjacent numbers with a comma followed by one space: , .