function Main(input) {
  var inputs = input.split(" ");
  var k = Number(inputs[0]);
  var s = Number(inputs[1]);
  var cnt = 0;

  for (var x = 0; x <= k; x++)
    for (var y = 0; y <= k; y++) if (s - (x + y) >= 0 && s - (x + y) <= k) cnt++;
  console.log(cnt)
}

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