#include <cstdio>
using namespace std;
struct node {
int l,r,dis,mid;
void mid_()
{
mid=(l+r)>>1;
}
};
struct node tree[30000*4+1];
int n,m;
inline void tree_up(int now)
{
tree[now].dis=tree[now<<1].dis+tree[now<<1|1].dis;
}
void tree_build(int now,int l,int r)
{
tree[now].l=l,tree[now].r=r;
if(l==r)
{
tree[now].dis=1;
return ;
}
tree[now].mid_();
tree_build(now<<1,l,tree[now].mid);
tree_build(now<<1|1,tree[now].mid+1,r);
tree_up(now);
return ;
}
int tree_out(int now,int ci)
{
if(tree[now].l==tree[now].r)
{
tree[now].dis=0;
return tree[now].l;
}
if(tree[now<<1].dis<ci) ci=tree_out(now<<1|1,ci-tree[now<<1].dis);
else ci=tree_out(now<<1,ci);
tree_up(now);
return ci;
}
int main()
{
scanf("%d%d",&n,&m);
tree_build(1,1,n);
int now=0;
do
{
now=(now-1+m)%n;
printf("%d ",tree_out(1,now+1));
} while(--n);
return 0;
}