num = [0,1,2,3,4,5,6,7,8,9]
while (str = gets) != "0 0\n" do
	strArr = str.split("\s")
	tmp = 0
	num.combination(strArr[0].to_i).each do |i|
		if i.inject{|sum, n| sum + n} == strArr[1].to_i then
			tmp += 1
		end
	end
	p tmp
end