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

function Main(args){
    var input = args.split(" ");
    var K = parseInt(input[0], 10);
    var S = parseInt(input[1], 10);
    var count = 0;

    for(var i = 0; i<=K; i++){
        for(var j=0; j<=K; j++){
            if(0<=S-i-j && S-i-j<=K)
                count++;
                break;
            }
        }
    }

    console.log( count );
}