#include <iostream> using namespace std; int main() { int n, m; while(cin>>n>>m) { int s = 0; for(int i=2;i<=n;i++) { s = (s+m)%i; } cout<<"The Winner is "<<s+1<<endl; } }
#include <iostream> using namespace std; int main() { int n, m; while(cin>>n>>m) { int s = 0; for(int i=2;i<=n;i++) { s = (s+m)%i; } cout<<"The Winner is "<<s+1<<endl; } }