#include<bits/stdc++.h>
using namespace std;	
typedef long long ll;
typedef long double db;
#define all(x) x.begin(),x.end()
const int N=1e6;
ll dp[3][N+N+N+10];
int main(){
	int n;cin>>n;
	ll k;cin>>k;
	for(int i=1;i<=n;i++)dp[0][i]=1;
	for(int i=1;i<=n+n;i++)dp[0][i]+=dp[0][i-1];
	for(int i=1;i<=n+n;i++){
		dp[1][i]=dp[0][i-1]-dp[0][max(i-n-1,0)];
	}
	for(int i=1;i<=n+n+n;i++){
		dp[1][i]+=dp[1][i-1];
	}
	for(int i=3;i<=n+n+n;i++){
		dp[2][i]=dp[1][i-1]-dp[1][max(i-n-1,0)];
	}
	int s=-1,x=-1;
	for(int i=3;i<=n+n+n;i++){
		if(k<=dp[2][i]){
			s=i;
			break;
		}	
		k-=dp[2][i];
	}
	for(int i=n+n+n;i>=1;i--){
		dp[1][i]-=dp[1][i-1];
	}
	for(int i=1;i<=n&&i<=s;i++){
		if(k<=dp[1][s-i]){
			x=i;
			break;
		}
		k-=dp[1][s-i];
	}
	int y=-1;
	memset(dp[0],0,sizeof dp[0]);
	for(int i=1;i<=n+n+n;i++)dp[0][i]=0;
	for(int i=1;i<=n;i++)dp[0][i]=1;
	for(int i=1;i<=n&&i<=s;i++){
		if(k<=dp[0][s-x-i]){
			y=i;
			break;
		}
		k-=dp[0][s-x-i];
	}
	cout<<x<<' '<<y<<' '<<s-x-y;
} 
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

ll solve(ll a, ll cnt) {
	return (a+(a+cnt-1))*cnt/2;
}

ll calc(ll sum, ll x) {
	x = min(x, sum-1);
	sum = min(sum, x*2);
	if(sum<2)
		return 0;
	ll tmp = 0;
	ll cnt = 2*x-sum+1;
	tmp += solve(sum-x, cnt);
	tmp += (sum-x-1)*x;
	return tmp;
}

ll calc2(ll sum, ll x) {
	x = min(x, sum-1);
	if(sum<2 || x*2<sum)
		return 0;
	return x-(sum-x)+1;
}

int main() {
	ll n, k;
	scanf("%lld%lld", &n, &k);
	ll l = 3, r = 3*n;
	while(l<r) {
		ll mid = (l+r)>>1;
		ll cnt = 0;
		for(int i=n; i>=1; i--)
			cnt += calc(mid-i, n);
		// printf("mid=%lld cnt=%lld\n", mid, cnt);
		if(cnt<k)
			l = mid+1;
		else
			r = mid;
	}
	if(l>3) {
		ll cnt = 0;
		for(int i=n; i>=1; i--)
			cnt += calc(l-1-i, n);
		k -= cnt;
	}
	ll sum = l;
	// printf("sum=%lld k=%lld\n", sum, k);
	for(int i=1; i<=n && i<=sum-2; i++) {
		ll tmp = calc2(sum-i, n);
		if(k<=tmp) {
			sum -= i;
			printf("%d ", i);
			break;
		}
		k -= tmp;
	}
	for(int i=max(1LL, sum-n); i<=n && i<=sum-1; i++) {
		if(k==1) {
			printf("%d %d\n", i, sum-i);
			break;
		}
		k--;
	}
	return 0;
}