参考:https://www.luogu.com.cn/problem/P8671
参考:https://zhuanlan.zhihu.com/p/121159246
参考:https://blog.csdn.net/doge__/article/details/82429348
#include <bits/stdc++.h>
using namespace std;
int n,k,s;
int main(){
cin>>n>>k;
for(int i=2;i<=n;i++){
s=(s+k)%i;
}
cout<<s+1<<endl;
return 0;
}