#include #include using namespace std; int main() { int n, m; cin >> n >> m; vector a; for (int i = 0; i < n; i++) { a.push_back(i + 1); } int idx = 0; while (!a.empty()) { idx = (idx + m - 1) % a.size(); cout << a[idx] << " "; a.erase(a.begin() + idx); } cout << endl; return 0; }