#include<iostream>
using namespace std;
using ll = long long;

ll sum_comb(ll n) {
  if (n <= 2) return 0;
  return (n - 1) * (n - 2) / 2;
}

ll sum_comb2(ll n, ll N) {
  return (sum_comb(n) - sum_comb(n - 3 * N)) - 3 * (sum_comb(n - N) - sum_comb(n - 2 * N));
}

int main() {
  int N; ll K;
  cin >> N >> K;
  ll cnt = 0; int sum = 3;
  while (true) {
    cnt += sum_comb2(sum, N);
    if (cnt >= K) break;
    sum++;
  }
  cnt -= sum_comb2(sum, N);
  
  int i = 1;
  while (true) {
    cnt += max(0, min(sum - i - 1, 2 * N - sum + i + 1));
    if (cnt >= K) break;
    i++;
  }
  cnt -= min(sum - i - 1, 2 * N - sum + i + 1);
  
  int j = K - cnt + max(0, sum - i - N - 1);
  int k = sum - i - j;
  
  cout << i << " " << j << " " << k << endl;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int i=a;i<n;++i)
#define eFOR(i,a,n) for(int i=a;i<=n;++i)
constexpr int INF = 1000000000;
int main() {
    ll n, k; cin >> n >> k;

    VL cnt2(n * 2 + 1);
    eFOR(i, 1, n) {
        ++cnt2[i + 1];
        if (i + n + 1 <= n * 2)--cnt2[i + n + 1];
    }


    eFOR(i, 1, n * 2) {
        cnt2[i] += cnt2[i - 1];
    }

    VL cnt3(n * 3 + 1);
    eFOR(i, 1, n * 2) {
        cnt3[i + 1] += cnt2[i];
        if (i + n + 1 <= n * 3)cnt3[i + n + 1] -= cnt2[i];
    }

    eFOR(i, 1, n * 3) {
        cnt3[i] += cnt3[i - 1];
    }

    ll s3_sum = 0, s3 = 0;
    eFOR(i, 1, n * 3) {
        if (s3_sum + cnt3[i] >= k) {
            s3 = i;
            break;
        }
        s3_sum += cnt3[i];
    }


    ll ki_sum = 0, ki = 0;
    eFOR(i, 1, n) {
        if (s3 - i > n * 2)continue;
        if (s3_sum + ki_sum + cnt2[s3 - i] >= k) {
            ki = i;
            break;
        }
        ki_sum += cnt2[s3 - i];
    }

    ll oi_sum = 0, oi = 0;
    eFOR(i, 1, n) {
        if (s3 - ki - i > n)continue;
        if (s3_sum + ki_sum + oi_sum + 1 >= k) {
            oi = i;
            break;
        }
        oi_sum += 1;
    }

    cout << ki << " " << oi << " " << s3 - ki - oi << "\n";

    return 0;
}