#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;
#define ll long long
#define pb push_back
#define pp pair<long long,long long>
#define ppp pair<pair<long long,long long>, long long >
#define f first	
#define s second
#define pd pair<double,long long>
#define pv pair<long long,vector<pair<long long,long long> > >
void solveTestCase() {
	ll i,j,k,n,m,x,y;
	cin>>n>>k;
	ll op1 = 2*n+k;
	ll op2 = 2+k;
	op1=min(op1,2*n);
	op2=max(op2,2ll);
	ll ans=0;
	for (i=op2;i<=op1;i++) {
		ll res=i-1;
		if (i>n)
			res=(2*n-i+1);
		j=i-k;
		ll res2=j-1;
		if (j>n)
			res2=(2*n-j+1);
		ans+=res*res2;
	}
	cout<<ans<<'\n';

}
int main() {
	ll t,n,i,j,k,l;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll p;
	t=1;
//	cin>>t;
	for (ll T=1;T<=t;T++) {
//		cout<<"Case #"<<T<<": ";
		solveTestCase();
	}
	return 0;
}
#include <iostream>
using namespace std;
 
typedef long long ll;
 
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)<(y)?(y):(x))
 
ll comb(ll n, ll k){
    if (k == 0 || k == n) return 1;
    if (k == 1 || k == n-1) return n;
    return comb(n-1,k)+comb(n-1,k-1);
}
 
int main(){
    ll n,k;cin >> n >> k;--k;
    for(ll xyz=3;xyz<=3*n;++xyz){
        if(xyz <= n+1){
            ll s = (xyz-1)*(xyz-2)/2;
            if(s <= k){
                k -= s;
                continue;
            }
            for(ll x=1;x<=xyz-2;++x){
                ll c = xyz-1-x;
                if(c <= k){
                    k -= c;
                    continue;
                }
                ll y=1+k;
                cout << x << " " << y << " " << (xyz-x-y) << "\n";
                return 0;
            }
        }else if(xyz < 2*n+1){
            ll s = (3*n-xyz+2)*(xyz-n-1)/2;
            if(s <= k){
                k -= s;
            }else{
                for(ll x=1;x<=xyz-n-1;++x){
                    ll c = 2*n-xyz+1+x;
                    if(c <= k){
                        k -= c;
                        continue;
                    }
                    ll y=xyz-n-x+k;
                    cout << x << " " << y << " " << (xyz-x-y) << "\n";
                    return 0;
                }
            }
            s = (xyz-2)*(2*n-xyz+1)/2;
            if(s <= k){
                k -= s;
                continue;
            }
            for(ll x=xyz-n;x<=n;++x){
                ll c = xyz-1-x;
                if(c <= k){
                    k -= c;
                    continue;
                }
                ll y=1+k;
                cout << x << " " << y << " " << (xyz-x-y) << "\n";
                return 0;
            }
        }else{
            ll s = (3*n-xyz+2)*(3*n-xyz+1)/2;
            if(s <= k){
                k -= s;
                continue;
            }
            for(ll x=xyz-2*n;x<=n;++x){
                ll c = 2*n-xyz+1+x;
                if(c <= k){
                    k -= c;
                    continue;
                }
                ll y=xyz-n-x+k;
                cout << x << " " << y << " " << (xyz-x-y) << "\n";
                return 0;
            }
        }
    }
    return 0;
}
