#include <bits/stdc++.h>
using namespace std;
int tree[200005];
int a[200005],b[200005];
int N;
int read(int indx){
int sum=0;
while(indx>0){
sum=sum+tree[indx];
indx-=(indx&(-indx));
}
return sum;
}
void update(int indx,int val){
while(indx<=N){
tree[indx]+=val;
indx+=(indx&(-indx));
}
}
int bin_search(int l,int r,int x)
{
int m;
while(l<r){
m=(l+r)/2;
if(read(m)>=x){
r=m;
}
else
l=m+1;
}
return r;
}
int main(int argc, char const *argv[])
{
long long int m;
scanf("%d%lld",&N,&m);
a[N-1]=m-1;
for (int i = N-1; i >0; --i)
{
a[i-1]+=a[i]/(N-i);
a[i]%=(N-i);
}
a[0]%=N;
memset(tree,0,sizeof(tree));
for (int i = 0; i <N; ++i)
{
update(i+1,1);
}
for (int i = 0; i <N; ++i)
{
a[i]=bin_search(1,N,a[i]+1)-1;
update(a[i] + 1, -1);
}
for (int i = 0; i <N; ++i)
{
printf("%d ",a[i]+1);
}
printf("\n");
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IHRyZWVbMjAwMDA1XTsKaW50IGFbMjAwMDA1XSxiWzIwMDAwNV07CmludCBOOwoKaW50IHJlYWQoaW50IGluZHgpewogICAgaW50IHN1bT0wOwogICAgd2hpbGUoaW5keD4wKXsKICAgICAgICBzdW09c3VtK3RyZWVbaW5keF07CiAgICAgICAgaW5keC09KGluZHgmKC1pbmR4KSk7CiAgICB9CiAgICByZXR1cm4gc3VtOwp9CnZvaWQgdXBkYXRlKGludCBpbmR4LGludCB2YWwpewogICAgd2hpbGUoaW5keDw9Til7CiAgICAgICAgdHJlZVtpbmR4XSs9dmFsOwogICAgICAgIGluZHgrPShpbmR4JigtaW5keCkpOwogICAgfQp9CmludCBiaW5fc2VhcmNoKGludCBsLGludCByLGludCB4KQp7CiAgICBpbnQgbTsKICAgIHdoaWxlKGw8cil7CiAgICAgICAgbT0obCtyKS8yOwogICAgICAgIGlmKHJlYWQobSk+PXgpewogICAgICAgICAgICByPW07CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICAgICAgbD1tKzE7CiAgICB9CiAgICByZXR1cm4gcjsKfQoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgY29uc3QgKmFyZ3ZbXSkKewogICAgICBsb25nIGxvbmcgaW50IG07CiAgICBzY2FuZigiJWQlbGxkIiwmTiwmbSk7CgogICAgICAKICAgIGFbTi0xXT1tLTE7CiAgICBmb3IgKGludCBpID0gTi0xOyBpID4wOyAtLWkpCiAgICB7CiAgICAgICAgYVtpLTFdKz1hW2ldLyhOLWkpOwogICAgICAgIGFbaV0lPShOLWkpOwogICAgfQogICAgYVswXSU9TjsKCiAgICBtZW1zZXQodHJlZSwwLHNpemVvZih0cmVlKSk7CiAgICBmb3IgKGludCBpID0gMDsgaSA8TjsgKytpKQogICAgewogICAgICAgIHVwZGF0ZShpKzEsMSk7CiAgICB9CiAgICBmb3IgKGludCBpID0gMDsgaSA8TjsgKytpKQogICAgewogICAgICAgIGFbaV09YmluX3NlYXJjaCgxLE4sYVtpXSsxKS0xOwogICAgICAgIHVwZGF0ZShhW2ldICsgMSwgLTEpOyAgIAogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPE47ICsraSkKICAgIHsKICAgICAgICBwcmludGYoIiVkICIsYVtpXSsxKTsKICAgIH0KICAgIHByaW50ZigiXG4iKTsKICAgIHJldHVybiAwOwp9