#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> t;
main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
t.insert(i+1);
int cur=0;
while(n)
{
cur=(cur+k-1)%n--;
auto it=t.find_by_order(cur);
cout<<*it<<"\n";
t.erase(it);
}
}
I2luY2x1ZGUgPGV4dC9wYl9kcy9hc3NvY19jb250YWluZXIuaHBwPgojaW5jbHVkZSA8ZXh0L3BiX2RzL3RyZWVfcG9saWN5LmhwcD4KI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2UgX19nbnVfcGJkczsKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRyZWU8aW50LG51bGxfdHlwZSxsZXNzPGludD4scmJfdHJlZV90YWcsdHJlZV9vcmRlcl9zdGF0aXN0aWNzX25vZGVfdXBkYXRlPiB0OwoKbWFpbigpCiB7CiAgICBpb3M6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7CiAgICBpbnQgbixrOwogICAgY2luPj5uPj5rOwogICAgZm9yKGludCBpPTA7aTxuO2krKykKICAgICAgICB0Lmluc2VydChpKzEpOwogICAgaW50IGN1cj0wOwogICAgd2hpbGUobikKICAgIHsKICAgICAgICBjdXI9KGN1citrLTEpJW4tLTsKICAgICAgICBhdXRvIGl0PXQuZmluZF9ieV9vcmRlcihjdXIpOwogICAgICAgIGNvdXQ8PCppdDw8IlxuIjsKICAgICAgICB0LmVyYXNlKGl0KTsKICAgIH0KfQ==