combinations :: Int -> [a] -> [[a]]
combinations n xs = comb n (length xs) xs where
  comb 0 _ _ = [[]]
  comb r n a@(x:xs)
    | n == r    = [a]
    | otherwise = map (x:) (comb (r - 1) (n - 1) xs) ++ comb r (n - 1) xs

main = do
    input <- getLine
    if input == "0 0"
      then return ()
      else do let [n, s] = map (read :: String -> Int) $ words input
                  in putStrLn . show . length . filter (\x -> (sum x) == s) $ combinations n [0..9]
              main