import Control.Applicative
import Data.List
import System.Exit

solve :: Int -> Int -> Int
solve x y = length $ filter (== y) $ map sum $ filter ((3==) . length) (subsequences [1..x])

main = do
    [x, y] <- map (read :: String -> Int) . words <$> getLine
    if x == 0 && y == 0 then exitSuccess
                        else print $ solve x y
    main
