while s = gets do
  (@n, @s) = s.split().map(&:to_i)
  break if @n == 0 && @s == 0

  @a = Array.new
  @c = 0 

  def solve(i)
    if @a.size == @n
      @c += 1 if @a.inject(:+) == @s
      return
    end 

    (i..9).each { |j| 
      @a.push(j)
      solve(j + 1)
      @a.pop
    }   
  end 

  solve(0)

  puts @c
end