problem
solution
codes
//不好玩
#include<iostream>
using namespace std;
int n, m, a[30010], r, p;
int main(){
cin>>n>>m;
for(int i = 1; i <= n; i++)a[i]=i;
r = n; p = 1;
while(r>1){
p = (p+m-1)%r;
if(p==0)p=r;
cout<<a[p]<<" ";
for(int i = p; i <= r-1; i++)a[i]=a[i+1];
r--;
}
cout<<a[1]<<"\n";
return 0;
}