



cpp
#include<bits/stdc++.h>
using namespace std;
int n,m;
queue<int> q;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++) q.push(i);
int k=0;
while(!q.empty()){
k++;
if(k<m)//从队头出来,再次回到队尾
{
int id=q.front();//记录出去的编号
q.pop();
q.push(id); //再次从队尾入队
}
else{//只需要从队头出来
cout<<q.front()<<" ";
q.pop();
k=0;//将报数清空
}
}
return 0;
}