while gets do
  @n, @s = $_.split(' ').map(&:to_i)
  break if @n == 0 and @s == 0
  @a = []
  @c = 0

  def dfs(j)
    if @a.size >= @n
      @c += 1 if @a.inject(:+) == @s
      return
    end

    j.upto(9) do |i|
      @a.push(i)
      dfs(i+1)
      @a.pop
    end
  end

  dfs(0)
  puts @c
end