while str=gets
    @n,@s=str.split(nil).map(&:to_i)
    break if (@n==0)&&(@s==0)
    
    @a=[]
    @c=0
    
    def cal(i)
    if (@a.size==@n)&&(@a.inject(:+)==@s)
       @c+=1
       return
    end
    
    (i..9).each do |j|
        @a.push(j)
        cal(j+1)
        @a.pop
        end
    end
    cal(0)
    puts @c
end