#include <iostream>
using namespace std;
 
typedef long long ll;
 
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)<(y)?(y):(x))
 
ll comb(ll n, ll k){
    if (k == 0 || k == n) return 1;
    if (k == 1 || k == n-1) return n;
    return comb(n-1,k)+comb(n-1,k-1);
}
 
int main(){
    ll n,k;cin >> n >> k;--k;
    ll ss=0;
    for(ll xyz=3;xyz<=n+1;++xyz) ss += (xyz-1)*(xyz-2)/2;
    if(ss <= k){
        k -= ss;
    }else{
        for(ll xyz=3;xyz<=n+1;++xyz){
            ll s = (xyz-1)*(xyz-2)/2;
            if(s <= k){
                k -= s;
                continue;
            }
            for(ll x=1;x<=xyz-2;++x){
                ll c = xyz-1-x;
                if(c <= k){
                    k -= c;
                    continue;
                }
                ll y=1+k;
                cout << x << " " << y << " " << (xyz-x-y) << "\n";
                return 0;
            }
        }
    }
    ss=0;
    for(ll xyz=n+2;xyz < 2*n+1;++xyz) ss += ((3*n-xyz+2)*(xyz-n-1) + (xyz-2)*(2*n-xyz+1))/2;
    if(ss <= k){
        k -= ss;
    }else{
        for(ll xyz=n+2;xyz < 2*n+1;++xyz){
            ll s = (3*n-xyz+2)*(xyz-n-1)/2;
            if(s <= k){
                k -= s;
            }else{
                for(ll x=1;x<=xyz-n-1;++x){
                    ll c = 2*n-xyz+1+x;
                    if(c <= k){
                        k -= c;
                        continue;
                    }
                    ll y=xyz-n-x+k;
                    cout << x << " " << y << " " << (xyz-x-y) << "\n";
                    return 0;
                }
            }
            s = (xyz-2)*(2*n-xyz+1)/2;
            if(s <= k){
                k -= s;
                continue;
            }
            for(ll x=xyz-n;x<=n;++x){
                ll c = xyz-1-x;
                if(c <= k){
                    k -= c;
                    continue;
                }
                ll y=1+k;
                cout << x << " " << y << " " << (xyz-x-y) << "\n";
                return 0;
            }
        }
    }
    for(ll xyz=2*n+1;xyz<=3*n;++xyz){
        ll s = (3*n-xyz+2)*(3*n-xyz+1)/2;
        if(s <= k){
            k -= s;
            continue;
        }
        for(ll x=xyz-2*n;x<=n;++x){
            ll c = 2*n-xyz+1+x;
            if(c <= k){
                k -= c;
                continue;
            }
            ll y=xyz-n-x+k;
            cout << x << " " << y << " " << (xyz-x-y) << "\n";
            return 0;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N; ll K;
ll dp[4][3010101];
//---------------------------------------------------------------------------------------------------
int getTot() {
	ll cu = 1;
	rep(tot, 3, 3010101) {
		if (cu <= K && K < cu + dp[3][tot]) return tot;
		cu += dp[3][tot];
	}
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;

	dp[0][0] = 1;
	rep(cnt, 0, 3) {
		rep(tot, 0, 2010101) {
			dp[cnt + 1][tot + 1] += dp[cnt][tot];
			dp[cnt + 1][tot + N + 1] -= dp[cnt][tot];
		}
		rep(tot, 1, 3010101) {
			dp[cnt + 1][tot] += dp[cnt + 1][tot - 1];
			chmin(dp[cnt + 1][tot], infl);
		}
	}

	int tot = getTot();

	rep(t, 0, tot) K -= dp[3][t];

	ll cu = 1;
	int ans_i = -1;
	rep(i, 1, N + 1) {
		if (cu <= K && K < cu + dp[2][tot - i]) {
			ans_i = i;
			break;
		}
		cu += dp[2][tot - i];
	}

	rep(t, 1, ans_i) K -= dp[2][tot - t];

	cu = 1;
	int ans_j = -1;
	rep(j, 1, N + 1) {
		if (cu <= K && K < cu + dp[1][tot - ans_i - j]) {
			ans_j = j;
			break;
		}
		cu += dp[1][tot - ans_i - j];
	}

	int ans_k = tot - ans_i - ans_j;
	printf("%d %d %d\n", ans_i, ans_j, ans_k);
}





