#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define setIO(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
#define closefile fclose(stdin), fclose(stdout)
#define m_p make_pair
#define sz(x) (int)x.size()
#define see(x) cerr << x << " "
#define seeln(x) cerr << x << endl
#define out(x) cerr << #x << " = " << x << " "
#define outln(x) cerr << #x << " = " << x << endl
#define outarr(x, l, r) {cerr<< #x"[" << l << " ~ " << r << "] = "; for (int _i = l; _i <= r; ++_i) cerr << x[_i] << " "; cerr << endl;}
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define gc() getchar()
//#define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T> void read(T &x)
{
    x = 0; int c = gc(); int flag = 0;
    while (c < '0' || c > '9') flag |= (c == '-'), c = gc();
    while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) +(c ^ 48), c = gc();
    if (flag) x = -x;
}
template <class T> T _max(T a, T b){return b < a ? a : b;}
template <class T> T _min(T a, T b){return a < b ? a : b;}
template <class T> bool checkmax(T &a, T b){return a < b ? a = b, 1 : 0;}
template <class T> bool checkmin(T &a, T b){return b < a ? a = b, 1 : 0;}
int n;
ll k;
ll cnt[3000005];
ll divi(int x)
{
	if (x <= 0) return 0;
	return (ll)(x - 1) * (x - 2) / 2;
}

ll func(int m)
{
	ll p = divi(m) - divi(m - n) * 3LL + divi(m - n - n) * 3LL;
	return p;
}

void init()
{
	read(n); read(k);
	for (int i = 3; i <= n + n + n; ++i)
	{
		cnt[i] = func(i);
		cnt[i] += cnt[i - 1];
	}
}

ll calc(int x)
{
	if (x > n + n) return 0;
	if (x < 2) return 0;
	if (x > n + 1) x = n + n + 2 - x;
	return x - 1;
}

void solve()
{
	ll R = 0; int P = 0;
	for (int i = 3; i <= n + n + n; ++i) if (cnt[i] >= k)
	{
		R = k - cnt[i - 1];
		P = i;
		break;
	}
	int ans1 = 0, ans2 = 0;
	ll t = 0;
	for (int i = 1; i <= n; ++i) if (i <= P)
	{
		ll c = calc(P - i);
		if (t + c >= R)
		{
			R -= t;
			ans1 = i;
			break;
		}
		t += c;
	}
	int now = 0;
	for (int i = 1; i <= n; ++i)
	{
		int o = P - ans1 - i;
		if (o >= 1 && o <= n)
		{
			++now;
			if (now == R)
			{
				ans2 = i;
				break;
			}
		}
	}
	printf("%d %d %d\n", ans1, ans2, P - ans1 - ans2);
}

int main()
{
	init();
	solve();
	return 0;
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min<ll>(a,b)
#define rmax(a,b) a = max<ll>(a,b)

#define fi first
#define se second

const int N = 3e6+10;
ll dp[3][N], pref[3][N];
int ms;
void mp(ll *v, ll *p){
	for(int i = ms; i>=0; i--) p[i] = p[i+1]+v[i];
}

ll fsoma(ll *p, int l, int r){
	return p[l]-p[r+1];
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	ll n, k; cin >> n >> k;
	k--;
	ms = 3*(n-1);
	fr(i,n) dp[0][i] = 1;
	mp(dp[0],pref[0]);
	
	for(int cor = 1; cor<=2; cor++){
		for(int i = 0; i<=3*(n-1); i++){
			dp[cor][i] = fsoma(pref[cor-1],max<int>(0,i-(n-1)),i);
		}
		mp(dp[cor],pref[cor]);
	}
		
	ll qnt = 0;
	for(ll s = 0; s<=3*(n-1); s++){
		qnt+= dp[2][s];
		if(qnt>k){
			qnt-= dp[2][s];
			fr(a,n){
				ll add = dp[1][s-a];
				if(qnt+add>k){
					s-=a;
					fr(b,n){
						ll add = dp[0][s-b];
						if(qnt+add>k){
							ll c = s-b;
							cout << a+1 << " " << b+1 << " " << c+1 << "\n";
							return 0;
						}
						qnt+=add;
					}
				}
				qnt+=add;
			}
		}
	}
	assert(0);
}