#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 109;
const long long INF = numeric_limits<int>::max();
struct node {
int value;
node* prev;
node* next;
} a[N];
int n, m, x, cnt = 1, y;
node* now = &a[1];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
a[i].value = i;
if (i != 1) a[i].prev = &a[i - 1];
else if (i != n) a[i].next = &a[i + 1];
}
a[n].next = &a[1];
a[1].prev = &a[n];
while (cnt <= n) {
if (x % m == 0) {
cout << now->value << ' ';
now->prev->next = now->next;
now->next->prev = now->prev;
cnt++;
}
now = now->next;
x++; y++;
}
return 0;
}