import Control.Applicative

type Data = (Int, Int)

type Problem = [Data]

type Result = [Int]

count :: Data -> Int

count (n, x)
    = length $ filter (\xs -> sum xs == x) sets where
        sets = enum 3 1 n []

enum :: Int -> Int -> Int -> [Int] -> [[Int]]

enum 1 from to xs
    = [x:xs | x <- [from..to]]
    
enum n from to xs
    = concat [enum (n - 1) (x + 1) to (x:xs) | x <- [from..to]]

solve :: Problem -> Result

solve xs
    = map count xs

output :: Result -> String

output xs
    = concat $ map (\x -> show x ++ "\n") xs
    
input :: IO Problem

input
    = return =<< inputProblem []
    
inputProblem :: Problem -> IO Problem

inputProblem xs
    = do
        [n, x] <- map read.words <$> getLine
        if (n, x) /= (0, 0)
            then inputProblem $ xs ++ [(n, x)]
            else return xs
    
main :: IO ()

main
    = putStr.output =<< solve <$> input