import qualified Data.List as L

combinations :: Int -> [a] -> [[a]]
combinations r = filter ((== r) . length) . L.subsequences

count :: (a -> Bool) -> [a] -> Integer
count f = foldr (\ b -> if b then succ else id) 0 . map f

solve :: [Int] -> IO ()
solve [n,s] = print $ count ((== s) . sum) $ combinations n [0..9]
solve _ = undefined

main :: IO ()
main = getContents
    >>= mapM_ solve . takeWhile (/= [0,0]) . map (map read) . map words . lines