#P345. 【例60.2】 约瑟夫问题

【例60.2】 约瑟夫问题

Description

Legend has it that Joseph survived by quickly calculating this problem.
nn people stand in a circle, numbered from 11 to nn. Starting from the first person, they count off, and the mm-th person leaves the circle. The next person starts counting from 11 again, and the mm-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 nn and mm (1n,m1001≤n, m≤100).

Output Format

nn integers separated by spaces, representing the order in which people leave the circle.

Sample

6 4
4 2 1 3 6 5