open System
open System.Collections.Generic


let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let K,S=RS int|>fun c -> int c.[0],int c.[1]
    [for i in [0..K] do for j in [0..K] do yield (if (S-i-j)>=0 && (S-i-j)<=K then 1 else 0)]
    |>List.sum
    |>stdout.WriteLine
    0
