#include <iostream>
#include <vector>
using namespace std;
vector<int> v;
int n, m, t = -1;
int main() {
cin >> n >> m;
for(int i = 1; i <= n; i ++) v.push_back(i);
while(v.size()) {
t = (t + m) % v.size();
cout << v[t] << ' ';
v.erase(v.begin() + t);
t --; // 因为v.size()改变
}
return 0;
}