main = interact $ unlines . map (show . sum_of_integers . map read . words) . init . lines
sum_of_integers [n,s] = count n s [0,1,2,3,4,5,6,7,8,9]
 where
  count 0 0 _ = 1
  count 0 _ _ = 0
  count _ _ [] = 0
  count n' s' (x:xs) = count (n'-1) (s'-x) xs + count n' s' xs