#include <iostream>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <cassert>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <vector>
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
#define inf 0x3f3f3f3f
#define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VIT;
typedef vector<ll> VLT;
const int N = 110;
int n, m;
int f(int x, int len) {
if (len == n) return x;
x = (x + m - 1) % (len + 1);
x++;
return f(x, len + 1);
}
//int f[N][N];
int main() {
freopen("in.txt", "r", stdin);
IO;
cin >> n >> m;
VIT ans(n);
ans[0] = m;
for (int i = 2; i <= n; ++i) {
int x = (m - 1) % (n - i + 1) + 1;
ans[i - 1] = f(x, n - i + 1);
}
for (int i = 0; i < n; ++i) cout << ans[i] << ‘ ‘;
cout << endl;
//for (int i = 1; i <= n; ++i) f[1][i] = i;
//for (int i = 2; i <= n; ++i)
//for (int j = 1; j <= n - i + 1; ++j) {
//int t = (j + m - 1) % (n - i + 2) + 1;
//f[i][j] = f[i - 1][t];
//}
//for (int i = 1; i <= n; ++i) {
//int x = (m - 1) % (n - i + 1) + 1;
//cout << f[i][x] << ‘ ‘;
//}
//cout << endl;
return 0;
}
约瑟夫环