#include <iostream>
using namespace std
;
const int N
= 1000010;
int n
, k
;
int f
[N
];
int main()
{
f
[1] = 0;
cin
>> n
>> k
;
for (int i
= 2; i
<= n
; i
++ ) f
[i
] = (f
[i
- 1] + k
) % i
;
cout
<< f
[n
] + 1 << endl
;
return 0;
}
转载请注明原文地址: https://yun.8miu.com/read-58167.html