stdin.ReadLine()
|> fun x -> x.Split(' ')
|> Array.map int
|> fun x -> (x.[0], x.[1])
|> fun (k, s) ->
  [0..k]
  |> Seq.map (fun x ->
    [0..k]
    |> Seq.filter (fun y -> (s >= x + y) && (k >= s - x - y))
    |> Seq.length
  )
  |> Seq.reduce (+)
|> printfn "%A"
