/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.05.09 01:16:12
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

ll C(__int128_t N, __int128_t L) {
    __int128_t ans = 0;
    if (L-3 >= 3*N) ans -= (L-3*N)*(L-3*N-1)*(L-3*N-2)/6;
    if (L-3 >= 2*N) ans += 3*(L-2*N)*(L-2*N-1)*(L-2*N-2)/6;
    if (L-3 >= N) ans -= 3*(L-N)*(L-N-1)*(L-N-2)/6;
    if (L-3 >= 0) ans += L*(L-1)*(L-2)/6;
    return ans;
}
ll D(__int128_t N, __int128_t L, __int128_t B) {
    __int128_t ans = 0;
    if (L-3 >= 2*N+B) ans -= (L-3-(2*N+B)+2)*(L-3-(2*N+B)+1)/2;
    if (L-3 >= N+B) ans += 2*(L-3-(N+B)+2)*(L-3-(N+B)+1)/2;
    if (L-3 >= B) ans -= (L-3-(B)+2)*(L-3-(B)+1)/2;
    if (L-3 >= 2*N) ans += (L-3-(2*N)+2)*(L-3-(2*N)+1)/2;
    if (L-3 >= N) ans -= 2*(L-3-(N)+2)*(L-3-(N)+1)/2;
    if (L-3 >= 0) ans += (L-3-(0)+2)*(L-3-(0)+1)/2;
    return ans;
}
int main() {
    int N;cin >> N;
    ll K;cin >> K;
    int L1 = 2, L2 = 3*N;
    while(L2 - L1 > 1) {
        int mid = (L1+L2)/2;
        if (C(N,mid) >= K) L2 = mid;
        else L1 = mid;
    }
    int L = L2;
    K -= C(N,L-1);
    int B1 = 0,B2 = N;
    while(B2 - B1 > 1) {
        int mid = (B1+B2)/2;
        if (D(N,L,mid) >= K) B2 = mid;
        else B1 = mid;
    }
    int B = B2;
    K -= D(N,L,B-1);
    if (L-B <= N) cout << B << " " << K << " " << L-B-K << endl;
    else cout << B << " " << L-B-N+K-1 << " " << N-K+1 << endl;
    return 0;
}
#include <iostream>
#include <algorithm>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

const int MAX = 1000000;
int n, K;
int cnt_ijk[MAX * 3];
int cnt_jk[MAX * 2];
int r_cnt_jk[MAX * 2];

signed main() {
	int s, i, j, k;
	
	cin >> n >> K;
	
	//j + k = s, 0 <= j, k < n
	for (s = 0; s <= 2 * n - 2; s++) {
		if (s < n) cnt_jk[s] = s + 1;
		else cnt_jk[s] = 2 * n - 1 - s;
	}

	//j + k < s, 0 <= j, k < n
	for (s = 1; s <= 2 * n - 1; s++) {
		r_cnt_jk[s] = r_cnt_jk[s - 1] + cnt_jk[s - 1];
	}
	
	//i + j + k = s, 0 <= i, j, k < n
	for (s = 0; s <= 3 * n - 3; s++) {
		//l <= j + k && j + k <= r
		int l = max(0LL, s - (n - 1));
		int r = min(2 * n - 2, s);
		cnt_ijk[s] = r_cnt_jk[r + 1] - r_cnt_jk[l];
	}
	
	//detect. s = i + j + k
	for (s = 0; s <= 3 * n - 3; s++) {
		K -= cnt_ijk[s];
		if (K <= 0) break;
	}
	K += cnt_ijk[s];
	//cout << "s = " << s << ", K = " << K << endl;
	
	//detect. i
	for (i = 0; i < n; i++) {
		//let's count : j + k = s - i, 0 <= j, k < n
		if (s - i < 0 || s - i >= 2 * n - 1) continue;
		K -= cnt_jk[s - i];
		if (K <= 0) break;
	}
	K += cnt_jk[s - i];
	//cout << "i = " << i << ", K = " << K << endl;
	
	//detect. j
	for (j = 0; j < n; j++) {
		k = s - i - j;
		if (0 <= k && k < n) K--;
		if (K == 0) break;
	}
	
	//cout << "j = " << j << ", K = " << K << endl;
	k = s - i - j;
	
	//to 1-index
	i++; j++; k++;
	
	cout << i << " " << j << " " << k << endl;
	return 0;
}