#include<cstdio>
#include<iostream>
#define re register
using namespace std;

long long n,k;
long long sum=3;
long long a=1,b,c;

template<typename T>
inline void read(T&x){
	x=0;re bool f=true;re char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=false;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	x=f?x:-x;
}

template<typename T>
inline void write(T x){
	if(x<0) x=~x+1,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+'0');
}

int main(){
	read(n),read(k);
	while(1){
		long long res,tmp;
		if(sum<=n+2) res=(sum-1)*(sum-2)/2;
		else if(n+2<sum&&sum<=2*n+1){
			tmp=2*n+1-sum;
			res=(tmp+1+n)*(n-tmp)/2+(2*n-tmp-1)*tmp/2;
		}
		else{
			tmp=3*n-sum+1;
			res=tmp*(tmp+1)/2;
		}
//		if(k<1000000000000000000/2) cout<<"k: "<<k<<" res: "<<res<<" sum: "<<sum<<endl;
		if(k<=res) break;
		k-=res;
		sum++;
	}
//	cout<<"k: "<<k<<" sum: "<<sum<<endl;
	while(1){
		if(sum-a<=2*n) break;
		a++;
	}
//	cout<<"a: "<<a<<endl;
	if(a==1){
		if(sum<=n+2){
			long long i=sum-2;
			while(k>i){
				k-=i;
				a++,i--;
			}
		}
		else if(n+2<sum&&sum<=2*n+1){
			long long i=2*n+2-sum;
			while(1){
				long long res;
				if(i>n) res=2*n-i;
				else res=i;
				if(k<=res) break;
				k-=res;
				a++,i++;
			}
		}
	}
	else{
		long long i=1;
		while(k>i){
			k-=i;
			i++,a++;
		}
	}
	write(a),putchar(' ');
	if(sum-a<=n+1) b=1,c=sum-a-1;
	else b=sum-a-n,c=n;
	k--;
	while(k--) b++,c--;
	write(b),putchar(' '),write(c);
	return 0;
}
#include <bits/stdc++.h>
#define int long long

using namespace std;

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, k; cin >> n >> k;
    int real = k;
    vector <vector <int>> f(4, vector <int> (3 * n + 1)), sum(4, vector <int> (3 * n + 1));
    for (int i = 0; i <= 3 * n; ++ i) sum[0][i] = 1;
    /// f[i][j] : chọn i thằng, tổng thu được j
    for (int i = 1; i <= 3; ++ i){
        for (int j = 1; j <= 3 * n; ++ j){
            if (j > n) f[i][j] = (sum[i - 1][j - 1] - sum[i - 1][j - n - 1]);
            else f[i][j] = sum[i - 1][j - 1];
            sum[i][j] += sum[i][j - 1] + f[i][j];
        }
    }
    int en;
    for (int i = 1; i <= 3 * n; ++ i){
        if (k <= f[3][i]){
            en = i;
            break;
        }
        k -= f[3][i];
    }
    for(int i = 1; i <= n; ++ i){
        if (en - i > 2 * n) continue;
        int dau = max(1ll, en - i - n);
        int cuoi = min(n, en - i - 1);
        if (k > cuoi - dau + 1){
            k -= (cuoi - dau + 1);
            continue;
        }
        int x = dau + k - 1;
        int y = en - x - i;
        cout << i << " " << x << " " << y;
        return 0;
  }
}
