#include <iostream>
using namespace std;
int main()
{
int Joseph(int n,int m);
int n,m;
cin>>n>>m;
cout<<Joseph(n,m)<<endl;
return 0;
}
int Joseph(int n,int m)
{
if(n==2)
return((m%n)+1);
else
return((Joseph(n-1,m)-1+m)%n+1);
}
12-16
128
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)