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

int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> dp2(3*n+1);
	for (ll s2=2;s2<=2*n;++s2){
		dp2[s2]=min(s2-1,n)-max(s2-n,1LL)+1;
	}
	vector<ll> dp3(3*n+1);
	ll acu2=0;
	for (int i=0;i<=3*n;++i){
		dp3[i]=acu2;
		acu2+=dp2[i];
		if (i>=n) acu2-=dp2[i-n];
	}
	ll s=0;
	ll acu=0;
	while (true){
		if (acu>=k) break;
		s+=1;
		acu+=dp3[s];
	}
	ll a,b;
	// phase beauty
	k-=acu-dp3[s]+1;
	acu=0;
	for (a=max(1LL,s-2*n);a<=min(n,s-2);++a){
		ll sumbc=s-a;
		ll nxt=min(sumbc-1,n)-max(sumbc-n,1LL)+1;
		if (acu+nxt>k) break;
		acu+=nxt;
	}

	// phase taste
	k-=acu;
	acu=0;
	for (b=max(1LL,s-a-n);b<=min(n,s-a-1);++b){
		if (acu+1>k) break;
		acu+=1;
	}
	cout<<a<<' '<<b<<' '<<s-a-b<<'\n';
	return 0;


}
#include <bits/stdc++.h>
#define double long double

using namespace std;

struct Complex {
  double r, i;

  Complex(double _r = 0, double _i = 0) : r(_r), i(_i) {}
};

Complex operator + (const Complex &a, const Complex &b) {
  return Complex(a.r + b.r, a.i + b.i);
}

Complex operator - (const Complex &a, const Complex &b) {
  return Complex(a.r - b.r, a.i - b.i);
}

Complex operator * (const Complex &a, const Complex &b) {
  return Complex(a.r * b.r - a.i * b.i, a.r * b.i + a.i * b.r);
}

Complex operator / (const Complex &a, const Complex &b) {
  return Complex((a.r * b.r + a.i * b.i) / (b.r * b.r + b.i * b.i), (a.i * b.r - a.r * b.i) / (b.r * b.r + b.i * b.i));
}

Complex operator * (const Complex &a, const double &b) {
  return Complex(a.r * b, a.i * b);
}

const int N = 5e6 + 10;

int r[N];

void get_r(int lim) {
  for (int i = 0; i < lim; i++) {
    r[i] = (i & 1) * (lim >> 1) + (r[i >> 1] >> 1);
  }
}

void FFT(Complex *f, int lim, int rev) {
  for (int i = 0; i < lim; i++) {
    if (i < r[i]) {
      swap(f[i], f[r[i]]);
    }
  }
  const double pi = acos(-1.0);
  for (int mid = 1; mid < lim; mid <<= 1) {
    Complex wn = Complex(cos(pi / mid), rev * sin(pi / mid));
    for (int len = mid << 1, cur = 0; cur < lim; cur += len) {
      Complex w = Complex(1, 0);
      for (int k = 0; k < mid; k++, w = w * wn) {
        Complex x = f[cur + k], y = w * f[cur + mid + k];
        f[cur + k] = x + y, f[cur + mid + k] = x - y;
      }
    }
  }
  if (rev == -1) {
    for (int i = 0; i < lim; i++) {
      f[i].r /= lim;
    }
  }
}

long long a[N], b[N], n, k;

Complex A[N], B[N];

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    A[i] = Complex(1.0, 0);
  }
  int lim = 1;
  while (lim <= 3 * n) {
    lim <<= 1;
  }
  get_r(lim);
  FFT(A, lim, 1);
  for (int i = 0; i < lim; i++) {
    B[i] = A[i] * A[i] * A[i];
    A[i] = A[i] * A[i];
  }
  FFT(A, lim, -1);
  FFT(B, lim, -1);
  for (int i = 3; i <= 3 * n; i++) {
    b[i] = (long long)(B[i].r + 0.5);
  }
  for (int i = 2; i <= 2 * n; i++) {
    a[i] = (long long)(A[i].r + 0.5);
  }
  // for (int i = 1; i <= 3 * n; i++) {
  //   printf("%lld ", a[i]);
  // }
  // puts("");
  // for (int i = 1; i <= 3 * n; i++) {
  //   printf("%lld ", b[i]);
  // }
  // puts("");
  long long sum;
  for (int i = 3; i <= 3 * n; i++) {
    if (k > b[i]) {
      k -= b[i];
    }
    else {
      sum = i;
      break;
    }
  }
  // cout << k << "\n";
  for (int i = 1; i <= n; i++) {
    if (k > a[sum - i]) {
      k -= a[sum - i];
    }
    else {
      for (int j = 1; j <= n; j++) {
        if (i + j < sum && sum - i - j >= 1 && sum - i - j <= n) {
          k--;
          if (k == 0) {
            printf("%d %d %d\n", i, j, sum - i - j);
            return 0;
          }
        }
      }
      break;
    }
  }
  return 0;
}