#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	bool flag=1;
	int x=0;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
			flag=0;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return (flag?x:~(x-1));
}
int n,k,f[3000001][4],pre[3000001][4];
signed main()
{
	n=read();
	k=read();
	for(int i=0;i<=3*n;i++)
		pre[i][0]=1;
	f[0][0]=1;
	for(int i=1;i<=3;i++)
		for(int l=1;l<=3*n;l++)
		{
			f[l][i]=pre[l-1][i-1];
			if(l>n)
				f[l][i]-=pre[l-n-1][i-1];
			pre[l][i]=pre[l-1][i]+f[l][i];
		}
	for(int i=1;i<=3*n;i++)
		if(k<=f[i][3])
		{
			for(int l=1;l<=min(n,i-2);l++)
				if(i-l<=2*n)
				{
					if(k<=min(i-l-1,n)-max(i-l-n,1ll)+1)
						for(int j=max(i-l-n,1ll);j<=min(i-l-1,n);j++)
						{
							if(i-l-j>0)
								k--;
							if(k==0)
							{
								cout<<l<<" "<<j<<" "<<i-l-j<<endl;
								return 0;
							}
						}
					else
						k-=(min(i-l-1,n)-max(i-l-n,1ll)+1);
				}
		}
		else
			k-=f[i][3];
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 110

ll i, i1, j, k, k1, t, n, m, res, flag[10], a, b;
ll x, y, z, tt, sm;

ll bnm2(ll x) {
    if (x < 0) return 0;
    return (x * (x - 1)) / 2;
}

ll bnm1(ll x) {
    if (x < 0) return 0;
    return x;
}

ll calc2(ll x) {
    return bnm2(x + 2) - 3 * bnm2(x - n + 1) +
    3 * bnm2(x - 2 * n) - bnm2(x - 3 * n - 1);
}

ll calc1(ll x) {
    return bnm1(x + 1) - 2 * bnm1(x - n) +
    bnm1(x - 2 * n - 1);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n >> k; n--;
    for (i = 0; i <= 3 * n; i++) {
        // cout << "calc2 " << i _ calc2(i) << nl;
        if (tt + calc2(i) >= k) {
            sm = i; break;
        } else {
            tt += calc2(i);
        }
    }

    // cout << "sm = " << sm << nl;

    for (i = 0; i <= n; i++) {
        if (tt + calc1(sm - i) >= k) {
            x = i; break;
        } else {
            tt += calc1(sm - i);
        }
    }

    z = min(n, sm - x) - (k - tt) + 1;
    y = sm - x - z;
    x++; y++; z++;

    cout << x _ y _ z << nl;

    return 0;
}
