#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)

int main() {
    int N;
    long K;
    cin >> N >> K;
    vector<vector<long long>> dp(4,vector<long long>(3*N+4));
    dp.at(0).at(0) = 1;
    rep(i,3) {
        rep(j,i*N+1) {
            dp.at(i+1).at(j+1) += dp.at(i).at(j);
            dp.at(i+1).at(j+N+1) -= dp.at(i).at(j);
        }
        rep(j,(i+1)*N) {
            dp.at(i+1).at(j+1) += dp.at(i+1).at(j);
        }
    }
    int sum;
    for(int i=3; i<=3*N; i++) {
        if(K<=dp.at(3).at(i)) {
            sum = i;
            break;
        }
        else {
            K -= dp.at(3).at(i);
        }
    }
    rep(i,N) {
        int ans_1 = i+1;
        int jmin=max(1,sum-ans_1-N);
        int jmax=min(N,sum-ans_1-1);
        if(jmin>jmax) continue;
        if(K>(jmax-jmin+1)) {
            K -= jmax-jmin+1;
            continue;
        }
        int ans_2=jmin+K-1;
        int ans_3=sum-ans_1-ans_2;
        cout << ans_1 << " " << ans_2 << " " << ans_3 << endl;
        break;
    }
}
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

const int maxn=3e6+10;

int N;
ll K;
ll f[maxn];

ll getf(int x) {
	if (x<2||x>N+N) return 0;
	ll a=max(1,x-N),b=min(N,x-1);
	return b-a+1;
}

int main() {
//	freopen("input.txt","r",stdin);	
	std::ios::sync_with_stdio(false);cin.tie();
	cin>>N>>K;
	memset(f,0,sizeof(f));
	rep(i,3,3*N+1) {
		f[i]=f[i-1]+getf(i-1);
		if (i-N-1>=2) f[i]-=getf(i-N-1);
//		debug(f[i]);
	}
		
	int cur=2;
	while (1) {
		cur++;
		if (K<=f[cur]) break;
		else K-=f[cur];
	}
	debug(K);
	//sum is cur
	int b=0;
	while (1) {
		b++;
		if (K<=getf(cur-b)) break;
		else K-=getf(cur-b);
	}
	//first ele is b
	debug(cur);
	cout<<b<<" "<<max(0,cur-b-N-1)+K<<" "<<cur-b-max(0,cur-b-N-1)-K;
	return 0;
}
