#include <bits/stdc++.h>
using namespace std;
struct sg_tree
{
static const int MPOW=18;
static const int N=1<<MPOW-1;
int arr[N<<1];
sg_tree(){fill(arr,arr+(N<<1),0);}
void add(int x)
{
x+=N;
arr[x]=1;
while(x>>=1)
arr[x]=arr[x<<1]+arr[(x<<1)+1];
}
int get(int c,int cl,int cr,int x,int left)
{
if(cl==cr)
{
arr[c]=0;
return c-N;
}
int cm=(cl+cr)>>1,ret;
if(arr[c<<1]+left<=x)
ret=get((c<<1)+1,cm+1,cr,x,left+arr[c<<1]);
else
ret=get(c<<1,cl,cm,x,left);
arr[c]=arr[c<<1]+arr[(c<<1)+1];
return ret;
}
int get(int x)
{
return get(1,0,N-1,x,0);
}
} soldiers;
main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
soldiers.add(i+1);
int cur=0;
while(n)
{
cur=(cur+k-1)%n;
cout<<soldiers.get(cur)<<endl;
--n;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IHNnX3RyZWUKewogICAgc3RhdGljIGNvbnN0IGludCBNUE9XPTE4OwogICAgc3RhdGljIGNvbnN0IGludCBOPTE8PE1QT1ctMTsKICAgIGludCBhcnJbTjw8MV07CgogICAgc2dfdHJlZSgpe2ZpbGwoYXJyLGFycisoTjw8MSksMCk7fQoKICAgIHZvaWQgYWRkKGludCB4KQogICAgewogICAgICAgIHgrPU47CiAgICAgICAgYXJyW3hdPTE7CiAgICAgICAgd2hpbGUoeD4+PTEpCiAgICAgICAgICAgIGFyclt4XT1hcnJbeDw8MV0rYXJyWyh4PDwxKSsxXTsKICAgIH0KCiAgICBpbnQgZ2V0KGludCBjLGludCBjbCxpbnQgY3IsaW50IHgsaW50IGxlZnQpCiAgICB7CiAgICAgICAgaWYoY2w9PWNyKQogICAgICAgIHsKICAgICAgICAgICAgYXJyW2NdPTA7CiAgICAgICAgICAgIHJldHVybiBjLU47CiAgICAgICAgfQogICAgICAgIGludCBjbT0oY2wrY3IpPj4xLHJldDsKICAgICAgICBpZihhcnJbYzw8MV0rbGVmdDw9eCkKICAgICAgICAgICAgcmV0PWdldCgoYzw8MSkrMSxjbSsxLGNyLHgsbGVmdCthcnJbYzw8MV0pOwogICAgICAgIGVsc2UKICAgICAgICAgICAgcmV0PWdldChjPDwxLGNsLGNtLHgsbGVmdCk7CiAgICAgICAgYXJyW2NdPWFycltjPDwxXSthcnJbKGM8PDEpKzFdOwogICAgICAgIHJldHVybiByZXQ7CiAgICB9CgogICAgaW50IGdldChpbnQgeCkKICAgIHsKICAgICAgICByZXR1cm4gZ2V0KDEsMCxOLTEseCwwKTsKICAgIH0KfSBzb2xkaWVyczsKbWFpbigpCiB7CiAgICBpb3M6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7CiAgICBpbnQgbixrOwogICAgY2luPj5uPj5rOwogICAgZm9yKGludCBpPTA7aTxuO2krKykKICAgICAgICBzb2xkaWVycy5hZGQoaSsxKTsKICAgIGludCBjdXI9MDsKICAgIHdoaWxlKG4pCiAgICB7CiAgICAgICAgY3VyPShjdXIray0xKSVuOwogICAgICAgIGNvdXQ8PHNvbGRpZXJzLmdldChjdXIpPDxlbmRsOwogICAgICAgIC0tbjsKICAgIH0KfQo=