文件目录

#include <bits/stdc++.h>
using namespace std;
int main()
{
    queue<int> q;
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        q.push(i);
    int i = 1;
    while (!q.empty())
    {
        if (i != m)
        {
            q.push(q.front());
            q.pop();
            i++;
        }
        else
        {
            cout << q.front() << " ";
            q.pop();
            i = 1;
        }
    }
    return 0;
}