#include <bits/stdc++.h>

#define REP_(i, a_, b_, a, b, ...) \
  for (int i = (a), END_##i = (b); i < END_##i; ++i)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
using i64 = long long;

using namespace std;

int main() {
  i64 n, k;
  cin >> n >> k;
  const i64 n2 = n * 2, n3 = n * 3;

  vector<i64> f3(n3 + 3, 0LL);
  f3[3] = 1;
  f3[n + 3] = -3;
  f3[2 * n + 3] = 3;
  REP(i, 3) REP(j, n3) f3[j + 1] += f3[j];

  vector<i64> f2(n2 + 2, 0LL);
  f2[2] = 1;
  f2[n + 2] = -2;
  REP(i, 2) REP(j, n2) f2[j + 1] += f2[j];

  i64 rem = k;
  i64 s, x;
  for (s = 3; rem > f3[s]; ++s) {
    rem -= f3[s];
  }
  for (x = max(s - n * 2, 1LL); rem > f2[s - x]; ++x) {
    rem -= f2[s - x];
  }
  const i64 y = max(s - x - n, 1LL) + rem - 1;
  const i64 z = s - x - y;
  cout << x << " " << y << " " << z << endl;
}

#include <bits/stdc++.h>


long long int sum_arr(long long int start, long long int end) {
    if (start < 0 || end < 0) {
        return 0;
    }
    return (start + end) * (start - end + 1) / 2;
}


int main() {
    long long int N, K;
    std::cin >> N >> K;

    long long int res = K;
    for (long long int l = 3; l <= 3 * N; l++) {
        long long int c0 = (l - 1) * (l - 2) / 2;
        long long int c1 = sum_arr(l - 1 - (N + 1), 0) * 3;
        long long int c2 = sum_arr(l - 1 - N - (N + 1), 0) * 3;
        long long int c = c0 - c1 + c2;
        if (res - c <= 0) {
            // i + j + k == l
            // std::cout << l << " , " << res << std::endl;
            // std::cout << "l = " << l << std::endl;
            for (long long int i = std::max(1ll, l - 2 * N); i <= N; i++) {
                long long int jk = l - i;  // sum of j and k
                long long int cnt = std::min(N, jk - 1) - std::max(1ll, jk - N) + 1;
                // std::cout << i << " " << jk << " " << cnt << std::endl;
                // std::cout << i << " " << jk << " " << cnt << std::endl;
                if (res - cnt <= 0) {
                    long long int j = std::max(1ll, jk - N) + res - 1;
                    std::cout << i << " " << j << " " << l - i - j << std::endl;
                    return 0;
                }
                res -= cnt;
            }
            // std::cout << res << std::endl;
            // break;
        }
        res -= c;
    }
}
