let readIntArray _ =
    stdin.ReadLine().Split(" ") |> Array.map int

readIntArray ()
|> fun [| k; s |] ->
    [ for x in 0 .. k do
        if x <= s then
            for y in 0 .. k do
                if (x + y) <= s then
                    for z in 0 .. k do
                        if (x + y + z) = s then yield 1 ]
    |> List.length
    |> printfn "%d"
