#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e6 + 5;
ll dp[3][maxn] = {0};

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	ll n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		dp[0][i] = 1;
	ll s = 0;
	for (int i = 2; i <= 2 * n; i++)
	{
		s += dp[0][i - 1];
		if (i > n + 1)
			s -= dp[0][i - n - 1];
		dp[1][i] = s;
	}
	s = 0;
	for (int i = 3; i <= 3 * n; i++)
	{
		s += dp[1][i - 1];
		if (i > n + 1)
			s -= dp[1][i - n - 1];
		dp[2][i] = s;
		dp[2][i] += dp[2][i - 1];
	}
	ll l = 3, r = 3 * n;
	while (l < r)
	{
		ll mid = (l + r) >> 1;
		if (dp[2][mid] >= k)
			r = mid;
		else
			l = mid + 1;
	}
	k -= dp[2][l - 1];
	for (int i = 1; i <= n; i++)
	{
		if (dp[1][l - i] >= k)
		{
			cout << i << " ";
			for (int j = 1; j <= n; j++)
			{
				if (l - i - j <= n)
					k -= 1;
				if (k == 0)
				{
					cout << j << " " << l - i - j << endl;
					exit(0);
				}
			}
		}
		else
		{
			k -= dp[1][l - i];
		}
	}
}
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007ll
#define md 998244353ll
#define e1 1e-9
#define v vector< long long >
#define vv vector< vector< long long > >
#define p pair < long long,long long >
#define vp vector< pair < long long,long long > >
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ft first
#define sd second
#define all(x) x.begin() , x.end()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define b(i,a,b) for(ll i=a;i>=0;i--)
#define test \
    ll tt{0}; \
    cin>>tt; \
    while(tt--)
using namespace std;
bool prime(ll n) {
    if (n < 2)return false;
    for (ll x = 2; x * x <= n; x++) {
        if (n % x == 0)return false;
    }
    return true;
}
vector<ll> Seiveprime(ll n)
{
    vector<bool> isPrime(n, true);
    for (int i = 2; i * i < n; i++)
    {
        if (isPrime[i])
        {
            for (int j = i * i; j < n; j += i)
                isPrime[j] = false;
        }
    }
    vector<ll> prime;
    prime.push_back(2);
    for (int i = 3; i < n; i += 2)
        if (isPrime[i])
            prime.push_back(i);
    return prime;
}
vector<ll> factors(ll n) {
    vector<ll> f;
    for (ll x = 2; x*x <= n; x++) {
        while (n%x == 0) {
            f.pb(x);
            n /= x;
        }
    }
    if (n > 1) f.pb(n);
    return f;
}
vp pri_fact(ll n) {
    v x = factors(n);
    vp y;
    y.eb(x[0], 1);

    for (ll i = 1; i < x.size(); i++) {
        if (x[i] == x[i - 1]) {
            y.back().second++;
        } else {
            y.eb(x[i], 1);
        }
    }

    return y;
}
tuple<int,int,int> gcd(int a, int b) {
    if (b == 0) {
        return {1,0,a};
    } else {
        int x,y,g;
        tie(x,y,g) = gcd(b,a%b);
        return {y,x-(a/b)*y,g};
    }
}
ll mult(ll x,ll y,ll m) {
    return (x * y) % m;
}
//returns x^n (mod m)
ll bin_pow(ll x,ll n,ll m) {
    if (n == 0)return 1;
    if (n & 1)return mult(x, bin_pow(x, n - 1, m), m);
    return bin_pow(mult(x, x, m), n / 2, m);
}
ll ind_of_2(ll x) {
    ll i = 0;

    while (x / (1 << i) != 1)
        i++;

    return i;
}
ll add(ll x,ll y)
{
    x+=y;
    if(x>=md)return x-md;
    return x;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll n{0},k{0},aa{0},b{0},c{0};
    cin>>n>>k;

    v a(3*n+1);
    f(i,3,3*n+1){
        a[i]=(i-1)*(i-2)/2;
        if(i>=n+3)a[i]-=3*(i-n-1)*(i-n-2)/2;
        if(i>=2*n+3)a[i]+=3*(i-2*n-1)*(i-2*n-2)/2;
    }

    ll sum{0},x{0};
    f(i,3,3*n+1){
        if(sum+a[i]>=k)
        {
            x=i;
            break;
        } else sum+=a[i];
    }
    k-=sum;
    ll no{0},z1{0},z2{1};
    if(x>=n+2)z1=n;
    else z1=x-2;
    if(x>2*n+1)z2=x-2*n;
    f(i,z2,z1+1){
        ll b1{0},b2{0};
        if(x-i>n+1)
        {
            b1=x-i-n;
            b2=n;
        }
        else
        {
            b1=1;
            b2=x-i-1;
        }

        no+=b2-b1+1;
        if(no>=k)
        {
            aa=i;
            b=k-no+b2;
            c=x-aa-b;
            cout<<aa<<" "<<b<<" "<<c;
            break;
        }
    }

    return 0;
}