#include<stdio.h>
#include<algorithm>
using namespace std;

int main(){
    long N, K, S = -1, A = -1;
    scanf("%ld %ld", &N, &K);
    while(true){
        S++;
        long cnt;
        if(S < N) cnt = (S + 1) * (S + 2) / 2;
        else if(S < 2 * N - 2) cnt = (N * 9 - N * N * 3 + N * S * 6 - S * 6 - S * S * 2 - 4) / 2;
        else cnt = (N * 3 - S - 1) * (N * 3 - S - 2) / 2;
        if(K <= cnt) break;
        K -= cnt;
    }
    while(true){
        A++;
        long cnt = min(S - A + 1, N * 2 - S + A - 1);
        if(cnt <= 0) continue;
        if(K <= cnt) break;
        K -= cnt;
    }
    long B = S - A - min(S - A, N - 1), C = S - A - B;
    while(--K) B++, C--;
    printf("%ld %ld %ld\n", A + 1, B + 1, C + 1);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	int N;
	ll K;
	cin >> N >> K;
	ll dp[4][3000005] = {0};
	dp[0][0] = 1;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j <= i * N; j++) {
			dp[i + 1][j + 1] += dp[i][j];
			dp[i + 1][j + N + 1] -= dp[i][j];
		}
		for (int j = 1; j <= (i + 1) * N; j++) {
			dp[i + 1][j] += dp[i + 1][j - 1];
		}
	}
	int x;
	for (int i = 3; i <= 3 * N; i++) {
		if (K <= dp[3][i]) {
			x = i;
			break;
		} else {
			K -= dp[3][i];
		}
	}
	for (int i = 1; i <= N; i++) {
		int lo = max(1, x - i - N);
		int hi = min(N, x - i - 1);
		if (lo > hi) continue;
		if (K > (hi - lo + 1)) {
			K -= (hi - lo + 1);
			continue;
		}
		int y = lo + K - 1;
		int z = x - i - y;
		cout << i << " " << y << " " << z << endl;
		return 0;
	}
}
