#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
#define check(x) if(x>=mod) x-=mod
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int qpow(int x,int y){
    int ret = 1;
    while(y) {
        if(y & 1) ret = (ll)ret * x % mod;
        x = (ll)x * x % mod;
        y >>= 1;
    }
    return ret;
}
int n;ll k,dp[4][3000005],pre[3000005];
int main()
{
    cin>>n>>k;
    dp[0][0] = 1;rep(i,0,n+n+n) pre[i] = 1;
    rep(i,1,3) {
        rep(j,1,n+n+n) dp[i][j] = pre[j - 1] - (j <= n ? 0 : pre[j - n - 1]);
        pre[0] = dp[i][0];rep(j,1,n+n+n) pre[j] = pre[j - 1] + dp[i][j];
    }
    //rep(i,0,3) re[()]
    rep(sum,3,n+n+n) {
        if(k > dp[3][sum]) k -= dp[3][sum];
        else {
            rep(a,1,n) {
                ll cur = sum <= a ? 0 : dp[2][sum - a];
                if(k > cur) k -= cur;
                else {
                    rep(b,1,n) if(1 <= sum - a - b && sum - a - b <= n) {
                        k--;
                        if(!k) {printf("%d %d %d\n",a,b,sum-a-b);return 0;}
                    }
                }
            }
            break;
        }
    }
    return 0;
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std; 
 
typedef long long ll;
 
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<ti> vti;
typedef vector<tl> vtl;
 
typedef priority_queue<int> pq;
typedef priority_queue<ti,vector<ti>,greater<ti>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

 
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
	
	
	ll n,k;
	cin>>n>>k;
	
	vl dp(2*n+1,0);
	dp[2]=1;
	for(ll i=3; i<=2*n; i++){
		dp[i]=dp[i-1];
		if(i>n) dp[i]+=(n-(i-n)+1);
		else dp[i]+=i-1;
	}
	
	vl dp2(3*n+1,0);
	dp2[3]=1;
	for(ll i=4; i<=3*n; i++){
		dp2[i]=dp2[i-1];
		dp2[i]+=dp[min(i-1,2*n)]-dp[max(1LL,i-n)-1];
	}
	
	ll sum;
	for(ll i=3; i<=3*n; i++){
		if(dp2[i-1]<k) sum=i;
		else break;
	}
	
	ll cnt=dp2[sum-1];
	ll ans;
	for(ll i=1; i<=n; i++){
		if(sum-i>2*n) continue;
		ll prevcnt=cnt;
		cnt+=dp[sum-i]-dp[sum-i-1];
		if(prevcnt<k) ans=i;
		else break;
	}
	
	if(ans!=n) cnt-=dp[sum-(ans+1)]-dp[sum-(ans+1)-1];
	cnt-=dp[sum-ans]-dp[sum-ans-1];
	ll ans2;
	for(ll i=1; i<=n; i++){
		if(sum-i-ans>n) continue;
		ll prevcnt=cnt;
		cnt++;
		if(prevcnt<k) ans2=i;
		else {
			cnt=prevcnt;
			break;
		}
	}
	
	cout<<ans<<" "<<ans2<<" "<<sum-ans-ans2;
	return 0;
}
