#P345. 【例60.2】 约瑟夫问题
【例60.2】 约瑟夫问题
Description
Legend has it that Joseph survived by quickly calculating this problem.
people stand in a circle, numbered from to . Starting from the first person, they count off, and the -th person leaves the circle. The next person starts counting from again, and the -th person leaves. This continues until everyone has left the circle. Please output the order in which people leave the circle.
Input Format
Two integers and ().
Output Format
integers separated by spaces, representing the order in which people leave the circle.
Sample
6 44 2 1 3 6 5