#include<iostream>
using namespace std;
int main(void){
  int k,s;
  cin>>k>>s;
  int x,y,z,sum;
  for(x=0;x<=k;x++){
    for(y=0;y<=k;y++){
      z=s-x-y;
      if(z>=0&&z<=k)sum++;
    }
  }
  cout<<sum;
}