import           Control.Monad
import           Data.IORef
import           Data.List.Split
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
  [k, s] <- map read . words <$> getLine

  let ls = [0 .. k]
      ans = length . filter (== s) $ map sum [[x, y, z] | x <- ls, y <- ls, z <- ls]


  print ans