/*n=2:1,3, 3,1
n=3:1,3,6,7, 6,3,1
n=4:1,3,6,10,12, 12,10,6,3,1
n=5:1,3,6,10,15,18,19, 18,15,10,6,3,1
n=6:1,3,6,10,15,21,25,27, 27,25,21,15,10,6,3,1
n=7:1,3,6,10,15,21,28,33,36,37, 36,33,28,21,15,10,6,3,1
n=8:1,3,6,10,15,21,28,36,42,46,48, 48,46,42,36,28,21,15,10,6,3,1 
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e6+5;
int n;
ll k;
ll sum[maxn],temp[maxn];
/*int main(){
	int n;
	map<int,int>res;
	while(cin>>n){
		res.clear();
		for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
		for(int k=1;k<=n;k++)
		res[i+k+j]++;
	}
	for(int i=3;i<=3*n;i++){
		if(i!=3) cout<<",";
		cout<<res[i];
	}
	cout<<"\n";
	}
	return 0;
}*/
void init_sum(int n){                     //预处理和为sum时的三元数组的数量 
	ll pos=3;
	for(int j=1;j<=n;j++){
		sum[pos]=sum[pos-1]+j;
		pos++;
	}
	for(int j=n-2;j>0;j-=2){
		sum[pos]=sum[pos-1]+j;
		pos++;
	}
	if(n&1){
		int k=pos-2,l=pos;
		for(int i=pos;i<=3*n;i++){
			sum[i]=sum[k-(i-l)];
		}
	}
	else{
		int k=pos-1,l=pos;
		for(int i=pos;i<=3*n;i++){
			sum[i]=sum[k-(i-l)];
		}
	}
}
void init_temp(int n){
	for(int i=2;i<=n+1;i++)
	temp[i]=i-1;
	for(int i=n+2;i<=2*n;i++)
	temp[i]=temp[i-1]-1;
}
int main(){
	cin>>n>>k;
	init_sum(n);
	init_temp(n);
	ll ans=3;
	while(k>sum[ans]){
		k-=sum[ans];
		ans++;              //k<=sum[ans] 在sum=ans时可以求得其中的一个三元数组(i,j,k) 为第cnt个三元数组 
	}                       //i+j+k=ans
	//cout<<ans<<endl;
	for(int i=ans-2*n;i<=ans-2;i++){  //枚举i的值 
		if(i<1) continue;
		ll t1=ans-i;      //j+k
		if(k>temp[t1]){    //则第一个数大于i 
			k-=temp[t1];
		}
		else{
			cout<<i;
			int x,y;          //x+y=t1
			if(t1>n+1){
				x=t1-n,y=n;   //x:t1-n -> n y:n -> t1-n
			}
			else{
				x=1,y=t1-1;   //x:1 -> t1-1 y:t1-1 -> 1
			}
			//cout<<x<<" "<<y<<endl;
			k--;              //x y 在第一种情况下 
			while(k){
				x++,y--;      //从小到大枚举情况 直到k=0 
				k--;
			}
			cout<<" "<<x<<" "<<y<<endl;
			break;
		}
	}
	return 0;
}
//i+j+k=3*n
//i [1,n]
//j+k [2,2*n]
//2->n+1 cnt:1,2,……,n
//n+2->2*n cnt:n-1,n-2,……,1 
#include <bits/stdc++.h>
using namespace std;
const int MN = 200 + 5;
int dp[MN][MN][4], a[MN];
array<int,3> from[MN][MN][4];
long long f(int x) {return (long long)x * (x+1) / 2;}
int main () {
	int n; long long k,sofar = 0;
	scanf ("%d %lld",&n,&k);
	for (int c = 0; c <= 3 * (n-1); c++) {
		int low = max(0,c - (n - 1)), high = min(c,2*(n-1));
		long long ret = 0;
		if (n-1 <= low) ret += (long long)(n-1) * (high-low+1);
		else if (high <= n-1) ret += f(high) - f(low-1);
		else ret += (long long)(n-1) * (high-(n-1)) + f(n-1)-f(low-1);
		low -= (n-1); high -= (n-1);
		if (high <= 0) ret -= 0;
		else if (0 <= low) ret -= f(high) - f(low-1);
		else ret -= f(high);
		ret += high - low + 1;
		long long old = sofar;
		sofar += ret;
		if (sofar >= k) {
			long long go = 0; low += (n-1); high += (n-1);
			for (int get = high; get >= low; get--) {
				int goFirst = c - get;
				long long ree = go + old;
				go += min(c-goFirst,n-1) - max(c-goFirst+1-n,0) + 1;
				if (go + old >= k) {
					int togo = c - goFirst; long long add = 0;
					for (int nxt = 0; nxt < n; nxt++) if (nxt <= togo && 0 <= togo-nxt && togo-nxt < n) {
						++add;
						if (ree + add >= k) {
							printf ("%d %d %d\n",goFirst+1,1+nxt,1+c-goFirst-nxt);
							return 0;
						}
					}
					return 0;
				}
			}
			return 0;
		}
	}
	return 0;
}
