import Data.List

main = interact $ unlines.map (show.length.(\[n,s] -> solve n s).map read.words).lines

comb :: Int -> [a] -> [[a]]
comb 0 xs = [[]]
comb _ [] = []
comb n (x:xs) = [x:y | y <- comb (n-1) xs] ++ comb n xs

solve :: Int -> Int -> [[Int]]
solve n s = filter (\x -> (sum.zipWith (*) [1..n] $ x) == s) $ concat.map permutations.comb n $ [0..9]