nCombination [n, s] = length . filter (sumEq s) $ combinations n [0..9]
  where sumEq s ls = s == sum ls

main = do
  s <- getLine
  if s == "0 0"
     then return ()
     else do print . nCombination . map read . words $ s
             main

-- all combinations of distinct n elements of list xs.
-- cited from: http://www.geocities.jp/m_hiroi/func/haskell06.html
combinations :: Int -> [a] -> [[a]]
combinations n xs = comb n (length xs) xs
  where
    comb r n (y : ys)
      | r == 0    = [[]]
      | r >= n    = [y : ys]
      | otherwise = map (y :) (comb (r - 1) (n - 1) ys) ++ comb r (n - 1) ys