#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
//bool vis[1000];
//int x[]={1,-1,0,0};
//int y[]={0,0,1,-1};
//int f=0;
//"'';
int main(){
 ll n,k;
 cin>>n>>k;
ll sum=3*n;
vector<vector<ll> > dp(4,vector<ll>(sum+1,0));
vector<vector<ll> > sm(4,vector<ll>(sum+1,0));
dp[0][0]=1;
for(int i=0;i<=sum;i++){
    sm[0][i]=1;
}
for(int i=1;i<=3;i++){
    for(int j=1;j<=sum;j++){
        int mx=j-1;
        int mn=max(0ll,j-n);
        dp[i][j]=sm[i-1][mx];
        if(mn>0){
            dp[i][j]=dp[i][j]-sm[i-1][mn-1];
        }
       // cout<<i<<-1<<j<<-1<<dp[i][j]<<endl;
        sm[i][j]+=sm[i][j-1]+dp[i][j];
    }
}
int a;
for(int i=1;i<=sum;i++){
    if(sm[3][i]>=k){
            k=k-sm[3][i-1];
        a=i;
        break;
    }
}
//cout<<k<<endl;
//cout<<a<<endl;
for(int i=3;i>=1;i--){
    for(int j=1;j<=n;j++){
        if(a-j>=0&&dp[i-1][a-j]>=k){
            cout<<j<<" ";
            a=a-j;
            break;
        }
        else{
             k=k-dp[i-1][a-j];
        }
    }
}
cout<<endl;
}



#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
#define int unsigned long long
const int maxn=3e6+7;
int sum[maxn];
int a[maxn];
signed main()
{
	int n,k;
	cin>>n>>k;
	for(int i=3;i<=3*n;++i)
	{
		if(i<=n+2) sum[i]=sum[i-1]+(i-1)*(i-2)/2;
		else if(i<=2*n) sum[i]=sum[i-1]+(i-2)*(2*n-i+1)/2+(3*n-i+2)*(i-n-1)/2;
		else {
			int p=3*n+3-i;
			sum[i]=sum[i-1]+(p-1)*(p-2)/2;
		}
	}
	sum[3*n+1]=1000000000000000000+1;
	//cout<<sum[3*n]<<endl;
	int L=3,R=3*n;
	int s=-1;
	while(L<=R)
	{
		int mid=L+R>>1;
		if(sum[mid]<=k) s=mid,L=mid+1;
		else R=mid-1;
	}
	//cout<<sum[4]<<endl;
	if(sum[s]!=k) s++;
	//print(s);
	//cout<<k<<endl;
	int tar=k-sum[s-1];
	//cout<<tar<<endl;
	int res=0,pre=0;
	int beauty,taste;
	for(int i=1;i<=n;++i)
	{	
		if(s-i>2*n||s-i<2) continue;
		if(s-i<=n+1) res+=s-i-1;
		else res+=2*n-s+i+1;
		if(res>=tar) 
		{
			beauty=i;
			taste=tar-pre;
			break;
		}
		pre=res;
	}
	int ss=s-beauty;
	if(ss<=n+1) ;
	else taste=taste+ss-n-1;
	cout<<beauty<<" "<<taste<<" "<<s-beauty-taste<<endl;
}