process.stdin.resume();
process.stdin.setEncoding('utf8');
// Here your code !
process.stdin.on('data', function (chunk) {
    var lines = chunk.toString().split(' ');
    var k = parseInt(lines[0]);
    var s = parseInt(lines[1]);
    var value =0;
    
    
       for(var x=0; x<=k; x++)
       {
        for(var y=0; y<=k; y++)
            {
                var z = s - x -y;
                
                if(z<=k && z>=0){
                ++value;
                        }else{
                             value =value+0;
                            　}
                
            }
       }
     
        console.log(value);
});