function Main(input) {
  var inputs = input.split(' ');
  var K = Number(inputs[0]);
  var S = Number(inputs[1]);
  var count = 0;
  for(var X = 0; X <= K; X++) {
    for(var Y = 0; Y <= K; Y++) {
      var Z = (S - X - Y);
      if(0 <= Z && Z <= K) {
        count++;
      }
    }
  }
  console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
