#include <iostream>
using namespace std;
int i,j,k,s,o=0;
int main()
{
    cin>>k>>s;
    for (i=0;i<=k;i++)
        for (j=0;j<=k;j++)
            if (s-i-j<=k && s-i-j>=0) o++;
    cout<<o<<endl;
	return 0;
}
