import Data.List

main = getContents >>= mapM_ (print . solve . map read . words) . takeWhile (/= "0 0") . lines

solve :: [Int] -> Int
solve [n, s] = length . filter ((==s) . sum) . nub . map sort . filter ((== n) . length) $ subsequences [0..9]
