let KS: [Int] = readLine()!.characters.split(" ").map{ Int(String($0))! }
var res: Int = 0

for x in 0...KS[0] {
    for y in 0...KS[0] {
        let z: Int = KS[1] - x - y
        if 0 <= z && z <= KS[0] { res += 1}
    }
}
print(res)