var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){return null;}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function Main(){
  var k = 1*input[0].split(" ")[0]
  var s = 1*input[0].split(" ")[1]
 // console.log(y)
  var c = 0;
  for(var i = 0 ; i<=k; ++i){
     for(var j = 0 ; j<=(s-i) && j<=k; ++j){

       ++c
       
     }
  }
console.log(c)


  
}
Main();