import Control.Monad (foldM)

main = do
    [n,s] <- (map read . words) `fmap` getLine
    if n == 0 && s == 0 then return () else do
        print $ solve n s
        main

solve :: Int -> Int -> Int
solve n s = length $ filter (==(0,0)) $ foldM mayUse (n,s) [0..9]
    where
    mayUse (0,0) _ = [(0,0)]
    mayUse (0,_) _ = [] -- no hope
    mayUse (n,s) d
        | s < d = [] -- no hope
        | otherwise = [(n,s),(n-1,s-d)]