#include <iostream>
using namespace std;
 
typedef long long ll;
 
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)<(y)?(y):(x))
 
ll comb(ll n, ll k){
    if (k == 0 || k == n) return 1;
    if (k == 1 || k == n-1) return n;
    return comb(n-1,k)+comb(n-1,k-1);
}
 
int main(){
    ll n,k;cin >> n >> k;--k;
    for(ll xyz=3;xyz<=3*n;++xyz){
        if(xyz <= n+1){
            ll xmin = 1;
            ll xmax = xyz-2;
            if (xmin <= xmax){
                ll s = ((xyz-1-xmax)+(xyz-1-xmin))*(xmax-xmin+1)/2;
                if(s <= k){
                    k -= s;
                }else{
                    for(ll x=xmin;x<=xmax;++x){
                        ll c = xyz-1-x;
                        if(c <= k){
                            k -= c;
                            continue;
                        }
                        ll y=1+k;
                        ll z=xyz-x-y;
                        cout << x << " " << y << " " << z << "\n";
                        return 0;
                    }
                }
            }
        }else if(xyz < 2*n+1){
            {
                ll xmin = 1;
                ll xmax = xyz-n-1;
                if(xmin <= xmax){
                    ll s = ((n-(xyz-n-xmax)+1)+(n-(xyz-n-xmin)+1))*(xmax-xmin+1)/2;
                    if(s <= k){
                        k -= s;
                    }else{
                        for(ll x=xmin;x<=xmax;++x){
                            ll c = n-(xyz-n-x)+1;
                            if(c <= k){
                                k -= c;
                                continue;
                            }
                            ll y=xyz-n-x+k;
                            ll z=xyz-x-y;
                            cout << x << " " << y << " " << z << "\n";
                            return 0;
                        }
                    }
                }
            }
            {
                ll xmin = xyz-n;
                ll xmax = n;
                if (xmin <= xmax){
                    ll s = ((xyz-1-xmax)+(xyz-1-xmin))*(xmax-xmin+1)/2;
                    if(s <= k){
                        k -= s;
                    }else{
                        for(ll x=xmin;x<=xmax;++x){
                            ll c = xyz-1-x;
                            if(c <= k){
                                k -= c;
                                continue;
                            }
                            ll y=1+k;
                            ll z=xyz-x-y;
                            cout << x << " " << y << " " << z << "\n";
                            return 0;
                        }
                    }
                }
            }
        }else{
            ll xmin = xyz-2*n;
            ll xmax = n;
            ll s = ((n-(xyz-n-xmax)+1)+(n-(xyz-n-xmin)+1))*(xmax-xmin+1)/2;
            if(s <= k){
                k -= s;
            }else{
                for(ll x=xmin;x<=xmax;++x){
                    ll c = n-(xyz-n-x)+1;
                    if(c <= k){
                        k -= c;
                        continue;
                    }
                    ll y=xyz-n-x+k;
                    ll z=xyz-x-y;
                    cout << x << " " << y << " " << z << "\n";
                    return 0;
                }
            }
        }
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define MOD(a, m) ((a % m + m) % m)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll N, K;

int main(){
    cin >> N >> K;

    vector<vector<ll>> X(4, vector<ll>(3*N+1));
    vector<vector<ll>> S(4, vector<ll>(3*N+1));
    X[0][0] = 1;
    REP(i,3){
        S[i][0] = X[i][0];
        REP(k,3*N){
            S[i][k+1] = X[i][k+1] + S[i][k];
        }

        REPi(k,1,3*N+1){
            //// X[][k] <= {X[][k-N] ... X[][k-1]}
            X[i+1][k] = S[i][k-1];
            if(k-N-1 >= 0)
                X[i+1][k] -= S[i][k-N-1];
        }
    }

    ll sum = 0;
    ll num = -1;
    REP(i,3*N+1){
        auto tmp = X[3][i];
        if(sum+tmp >= K){
            num = i;
            K -= sum;
            break;
        }
        sum += tmp;
    }

    //cout << sum << endl;
    //cout << num << endl;

    ll left, mid;
    bool valid = false;
    for(left = 1; left <= N; left++){
        ll rem = num - left;
        if(rem < 0 || 3*N < rem) continue;
        ll n = X[2][rem];
        if(K > n){
            K -= n;
        }
        else{
            for(mid = 1; mid <= N; mid++){
                ll rem2 = rem - mid;
                if(rem2 < 0 || 3*N < rem2) continue;
                ll n = X[1][rem2];
                K -= n;
                if(K == 0){
                    valid = true;
                    break;
                }
            }
        }

        if(valid)
            break;
    }

    printf("%lld %lld %lld\n", left, mid, num - (left + mid));

    return 0;
}
