#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define forn(i,n) for(int i = 0; i < (int) n; i++)
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
typedef long long ll;

ll stars3(ll x) {
  return (x + 2) * (x + 1) / 2;
}

ll n;

// a + b + c = x
// 0 <= a,b,c < n
ll count3(ll x) {
  ll ans = stars3(x);
  if (x >= n) ans -= stars3(x - n) * 3;
  if (x >= 2 * n) ans += stars3(x - 2 * n) * 3;
  if (x >= 3 * n) ans -= stars3(x - 3 * n);
  return ans;
}

// b + c = x
// 0 <= b,c < n
ll count2(ll x) {
  ll ans = x + 1;
  if (x >= n) ans -= (x - n + 1) * 2;
  if (x >= 2 * n) ans += (x - 2 * n + 1);
  return ans;
}

int main() {
  ll k;
  cin >> n >> k;

  ll sm, tot = 0;
  for(sm = 0; sm <= 3 * n - 3; sm++) {
    ll cnt = count3(sm);
    if (tot + cnt >= k) break;
    tot += cnt;
  }

  int a;
  for(a = 0; a < n; a++) {
    ll cnt = count2(sm - a);
    if (tot + cnt >= k) break;
    tot += cnt;
  }

  int fs = max(0ll, sm - a - n + 1);
  int b = fs + k - tot - 1;
  int c = sm - a - b;

  cout << a + 1 << " " << b + 1 << " " << c + 1 << "\n";
}

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

int N;
long long K, dp[4][3000001];

int main() {
    scanf("%d %lld", &N, &K);
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    for (int i = 1; i <= 3; ++i) {
        long long x = 0;
        for (int j = 0; j <= N*i; ++j) {
            dp[i][j] = x, x += dp[i-1][j];
            if (j >= N) x -= dp[i-1][j-N];
        }
    }
    int sum = 0;
    for (sum = 0; sum <= N*3 && K > dp[3][sum]; ++sum) K -= dp[3][sum];
    int num = 1;
    while (num <= N && K > max(min(N,sum-num-1) - max(1,sum-num-N) + 1,0))
        K -= max(min(N,sum-num-1) - max(1,sum-num-N) + 1,0), num++;
    int x = max(1,sum-num-N) + K - 1;
    printf("%d %d %d", num, x, sum - num - x);

    return 0;
}
