#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, a, b, c = 2, s, t, now;
  bool ans = true;
  scanf("%lld%lld", &n, &k);
  if(k > n * n * n / 2) ans = false, k = n * n * n - k + 1;
  s = n + n + 1;
  while(s - c > 1) {
    t = (s + c) / 2;
    now = t * (t - 1) * (t - 2) / 6;
    if(t > n + 2) now -= (t - n) * (t - n - 1) * (t - n - 2) * 3 / 6;
    if(now < k) c = t;
    else s = t;
  }
  t = c;
  k -= t * (t - 1) * (t - 2) / 6;
  if(t > n + 2) k += (t - n) * (t - n - 1) * (t - n - 2) * 3 / 6;
  c++;
  now = 0;
  for(i = 1; ; ++i) {
    if(c - i > n) t = 2 * n - c + i + 1;
    else t = c - i - 1;
    if(now + t >= k) {
      a = i, k -= now;
      break;
    }
    now += t;
  }
  for(i = 1; k; ++i) if(a + i + n >= c) --k;
  b = i - 1;
  if(ans) printf("%lld %lld %lld", a, b, c - a - b);
  else printf("%lld %lld %lld", n - a + 1, n - b + 1, n - c + a + b + 1);
  return 0;
}
//ABC 200 E - Patisserie ABC 2
//https://atcoder.jp/contests/abc200/tasks/abc200_e

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

long long dp[4][3000005] = {};

int main() {
	int n;
	long long k;
	cin >> n >> k;
	//已选了几个数，其数字和是多少

	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 jmi = max(1, x - i - n);
		int jma = min(n, x - i - 1);
		if(jmi > jma) continue;
		if(k > (jma - jmi + 1)) {
			k -= (jma - jmi + 1);
			continue;
		}
		int y = jmi + k - 1;
		int z = x - i - y;
		cout << i << ' ' << y << ' ' << z << '\n';
		return 0;
	}
}
