import qualified Data.List as L

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

count :: (a -> Bool) -> [a] -> Integer
count f = sum . map g . map f
    where
        g True = 1
        g False = 0

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

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