#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXX 3000002
ll pre[3][MAXX];
ll dp[3][MAXX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll N,K; cin>>N>>K;
    ll MAX_SUM = 3LL*N;
    
    for(ll j=1;j<=MAX_SUM;++j)
    {
        if(j <= N)
            dp[0][j] = 1;
        
        pre[0][j] = pre[0][j - 1] + dp[0][j];
    }

    for(ll i=1;i<3;++i)
    {
        for(ll j=1;j<=MAX_SUM;++j)
        {
            ll L = max(0LL, j - N);
            ll R = max(0LL, j - 1);
            
            dp[i][j] = pre[i - 1][R] - ((L > 0) ? pre[i - 1][L - 1] : 0);
            pre[i][j] = pre[i][j - 1] + dp[i][j];
        }
    }
    
    ll sum = 0;

    for(ll i=1;i<=MAX_SUM;++i)
    {
        if(K <= dp[2][i])
        {
            sum = i;
            break;
        }

        K -= dp[2][i];
    }

    ll arr[3];

    for(ll i=1;i<=N;++i)
    {
        //Checking beauty = i
        ll rem_sum = sum - i;
        if(!dp[1][rem_sum])
            continue;

        if(K <= dp[1][rem_sum])
        {
            sum -= i;
            arr[0] = i;
            break;
        }

        K -= dp[1][rem_sum];
    }

    

    for(ll i=1;i<=N;++i)
    {
        //Checking taste = i
        ll rem_sum = sum - i;
        if(!dp[0][rem_sum])
            continue;
        
        if(K <= dp[0][rem_sum])
        {
            sum -= i;
            arr[1] = i;
            break;
        }

        K -= dp[0][rem_sum];
    }

    assert(K <= N);

    arr[2] = sum;

    cout<<arr[0]<<" "<<arr[1]<<" "<<arr[2]<<endl;
}
#include<bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define nep(i,r,l) for(int i=r;i>=l;i--)
void sc(int &x){scanf("%d",&x);}
void sc(int &x,int &y){scanf("%d%d",&x,&y);}
void sc(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sc(ll &x){scanf("%lld",&x);}
void sc(ll &x,ll &y){scanf("%lld%lld",&x,&y);}
void sc(ll &x,ll &y,ll &z){scanf("%lld%lld%lld",&x,&y,&z);}
void sc(char *x){scanf("%s",x);}
void sc(char *x,char *y){scanf("%s%s",x,y);}
void sc(char *x,char *y,char *z){scanf("%s%s%s",x,y,z);}
void out(int x){printf("%d\n",x);}
void out(ll x){printf("%lld\n",x);}
void out(int x,int y){printf("%d %d\n",x,y);}
void out(ll x,ll y){printf("%lld %lld\n",x,y);}
void out(int x,int y,int z){printf("%d %d %d\n",x,y,z);}
void out(ll x,ll y,ll z){printf("%lld %lld %lld\n",x,y,z);}
using namespace std;
const int N=3e6+5;
ll n,k,s2[N];
ll cal1(ll sum)
{
    if(sum<=2) return 0;
    ll l=max(1ll,sum-2*n),r=min(n,sum-2);
    l=sum-l;r=sum-r;
    swap(l,r);
    return s2[r]-s2[l-1];
}
ll cal2(ll sum)
{
    return min(n,sum-1)-max(1ll,sum-n)+1;
}
int main()
{
    //freopen("1.in","r",stdin);freopen("1.out","w",stdout);
    sc(n,k);
    ll ans=0;
    for(int i=2;i<=n*2;i++) s2[i]=cal2(i)+s2[i-1];
    for(ll i=3;i<=n*3;i++)
    {
        ll t=cal1(i);
        if(k>t) k-=t;
        else
        {
            for(ll j=max(1ll,i-2*n);j<=min(n,i-2);j++)
            {
                ll t=cal2(i-j);
                if(k>t) k-=t;
                else
                {
                    for(ll h=max(1ll,i-j-n);h<=min(n,i-j-1);h++)
                    {
                        k--;
                        if(k==0)
                        {
                            printf("%lld %lld %lld\n",j,h,i-j-h);
                            break;
                        }
                    }
                    break;
                }
            }
            break;
        }
    }
}
