"use strict"
function Main(input) {
  input = input.trim().split(' ').map(Number);
  const k = input[0];
  const s = input[1];
 
  let ret=0;
  for(let x=0; x<=k; ++x){
    for(let y=0; y<=k; ++y){
      let z = s-x-y;
      if(0<=z&&z<=k) ++ret;
    }
  }
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));