#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=3000005,INF=1<<30;

ll dp[MAX][4],sum[MAX][4];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;ll K;cin>>N>>K;
    K--;
    
    dp[0][0]=1;
    sum[0][0]=1;
    
    for(int i=1;i<=3*N;i++){
        for(int j=1;j<=3;j++){
            dp[i][j]+=sum[i-1][j-1];
            if(i-(N+1)>=0) dp[i][j]-=sum[i-(N+1)][j-1];
        }
        for(int j=0;j<=3;j++){
            sum[i][j]=dp[i][j]+sum[i-1][j];
        }
    }
    
    for(ll s=3;s<=3*N;s++){
        //cout<<dp[s][3]<<endl;
        if(K>=dp[s][3]) K-=dp[s][3];
        else{
            for(ll i=1;i<=N;i++){
                ll rem=s-i;
                if(rem<2||rem>2*N) continue;
                ll can=N-abs(N+1-rem);
                if(K>=can) K-=can;
                else{
                    for(ll j=1;j<=N;j++){
                        ll k=s-i-j;
                        if(1<=k&&k<=N){
                            if(K==0){
                                cout<<i<<" "<<j<<" "<<k<<endl;
                                return 0;
                            }
                            K--;
                        }
                    }
                }
            }
        }
    }
}

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
ostream& operator<<(ostream& os, lpair& h){ os << "(" << h.first << ", " << h.second << ")"; return os;}
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
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; }

void solve(){
    ll N,K;
    cin >> N >> K;
    ll cur = K;
    ll sum = -1;
    ll mid = (N*3 + 3) / 2;
    rep(n,3,N*3+1){
        ll idx, val;
        if(n <= mid){
            idx = n - 2;
            val = idx * (idx+1) / 2;
            if(n > N+2){
                ll j = n - (N+2);
                ll pena = 3 * j * (j+1) / 2;
                val -= pena;
            }
        }else{
            if((N*3+3) % 2 == 0){
                ll diff = n - mid;
                ll m = mid - diff;
                idx = m-2;
                val = idx * (idx+1) / 2;
                if(m > N+2){
                    ll j = m - (N+2);
                    ll pena = 3 * j * (j+1) / 2;
                    val -= pena;
                }
            }else{
                ll diff = n - mid;
                ll m = (mid+1) - diff;
                idx = m-2;
                val = idx * (idx+1) / 2;
                // print("m",n,m);
                if(m > N+2){
                    ll j = m - (N+2);
                    ll pena = 3 * j * (j+1) / 2;
                    val -= pena;
                }
            }
        }

        // print(n ,val);
        if(cur <= val){
            sum = n;
            break;
        }else{
            cur -= val;
        }
    }
    // print(sum, cur);
    rep(n,1,sum-1){
        ll nokori = sum - n;
        if(nokori > 2 * N) continue;
        ll start = nokori - N;
        if(start <= 1) start = 1;
        ll num = min(N, nokori-1) - start + 1;
        if(cur <= num){
            ll second_val = start + cur-1;
            print(n, second_val, sum-n-second_val);
            return;

        }else{
            cur -= num;
        }
    }
    // typedef struct{ll x,y,z;} P;
    // vector<P> v;
    // map<ll,ll> mp;
    // rep(i,0,N){
    //     rep(j,0,N){
    //         rep(k,0,N){
    //             v.push_back({i+1, j+1, k+1});
    //             mp[i+j+k+3]++;
    //         }
    //     }
    // }

    // sort(v.begin(), v.end(), [](P p1, P p2){
    //     if(p1.x+p1.y+p1.z == p2.x+p2.y+p2.z){
    //         if(p1.x == p2.x){
    //             return p1.y < p2.y;
    //         }
    //         return p1.x < p2.x;
            
    //     }
    //     return p1.x+p1.y+p1.z < p2.x+p2.y+p2.z;
    // });

    // // for(auto &e: v) print(e.x,e.y,e.z);
    // for(auto &e: mp){
    //     ll n = e.first - 2;
    //     // print(e.first, e.second, n*(n+1)/2, n*(n+1)/2 - e.second);
    // }


}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}