def solve(m,i,c)
#       puts "%d:%d:%d"%[m,i,c]
        return 0 if m==9
#       puts "!%d:%d"%[m,i] if c==1 && m<=i
        return 1 if c==1 && m<=i
        res = 0
        (m..i).each do |x|
                break if solve(x+1, i-x, c-1)==0
                res += 1
        end
        return res
end

while true
        n,s = gets.split.map{|x|x.to_i}
        exit if n==0

        puts (0..s).inject(0){|sum,x| sum + solve(x,s,n)}
end