#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <set>

using namespace std;

long long int N, K;

long long int num(long long int N, long long int k) {

	if (k <= N + 2) {
		return ((k - 2)*(k - 1)) / 2;
	}
	else if (k <= N * 2 + 1) {
		return ((k - 2)*(k - 1)) / 2 - ((k - 2 - N)*(k - 1 - N) * 3) / 2;
	}
	else if (k <= N * 3) {
		return ((N * 3 - k + 1)*(N * 3 - k + 2)) / 2;
	}

	return 0;

}

int cnt[10000];

long long int num2(long long int N, long long int m) {
	if (m <= N + 1) { return m - 1; }
	else if(m<=N*2) { return N * 2 - m + 1; }
	return 0;
}


int main(void) {

	
	cin >>N >> K;

	/*for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			for (int k = 1; k <= N; k++) {
				cnt[i + j + k]++;
			}
		}
	}

	for (int k = 3; k <= N*3; k++) {
		cout << "k= " << k << " " << num(N, k) << " "<<cnt[k]<< endl;
	}*/

	int k = 3;

	while (K > num(N, k)) {
		K -= num(N, k); k++;
	}

	//cout << "k= " << k << endl;

	long long int m = k - 1;
	while (K > num2(N, m)) {
		K -= num2(N, m); m--;
	}

	//cout << "m= " << m << endl;


	long long int ans1, ans2, ans3;

	ans1 = k - m;

	//cout << "K= " << K << endl;

	vector<pair<long long int, long long int> > V;
	for (long long int i = 1; i <= N; i++) {
		long long  int x = i; long long int y = m - x;
		if (1 <= x && x <= N && 1 <= y && y <= N) { V.push_back(make_pair(x, y)); }
	}

	ans2 = V[K - 1].first;
	ans3 = V[K - 1].second;

	cout << ans1 << " " << ans2 << " " << ans3 << endl;

	return 0;
}

/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<22;
int N;
LL K;
LL dp[4][SIZE];
void solve() {
    dp[0][0]=1;
    FOR(i,1,3){
        REPP(j,1,SIZE){
            dp[i-1][j]+=dp[i-1][j-1];
        }
        REPP(j,1,SIZE){
            if(j<=N){
                dp[i][j]=dp[i-1][j-1];
            }else{
                dp[i][j]=dp[i-1][j-1]-dp[i-1][j-N-1];
            }
        }
        for(int j=SIZE-1;j>0;j--){
            dp[i-1][j]-=dp[i-1][j-1];
        }
    }
    FOR(i,3,3*N){
        if(K<=dp[3][i]){
            FOR(j,1,N){
                if(K<=dp[2][i-j]){
                    FOR(k,1,N){
                        if(i-j-k<=N&&i-j-k>0){
                            K--;
                            if(!K){
                                W(j,k,i-j-k);
                                exit(0);
                            }
                        }
                    }
                }else{
                    K-=dp[2][i-j];
                }
            }
        }else{
            K-=dp[3][i];
        }
    }
}
void input() {
    R(N,K);
}
int main(){
    input();
    solve();
    return 0;
}
