#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>

#define MAXN 20010
using namespace std;

int f(int k) {
    int a=1,b=k*(k-1);
    for(int i=1;i<=2;i++)
        a*=i;
    //cout<<a<<b;
    return b/a;
}

int main() {
    int k, s;
    int cnt=0;
    cin >> k >> s;
    if (3 * k < s)
        cout << 0 << endl;
    else if (3 * k == 0)
        cout << 1 << endl;
    else
        cout<<f(2*k)<<endl;

}
