"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const main = () => fs_1.readFileSync('/dev/stdin', 'utf8').slice(0, -1);
const [k, s] = main()
    .split(' ')
    .map(x => +x);
let cnt = 0;
for (let i = 0; i <= k; i++) {
    for (let j = 0; j <= k; j++) {
        if (0 <= s - i - j && s - i - j <= k)
            cnt++;
    }
}
console.log(cnt);
