while gets do
  @n,@s=$_.split(' ').map(&:to_i)
  break if @n==0 and @s==0
  @a=Array.new
  @c=0
 
  def dfs(i)
    if @a.size == @n
      @c+=1 if @a.inject(:+)==@s
    end
 
    (i..9).each do |j|
      @a.push(j)
      dfs(j+1)
      @a.pop
    end
  end
  dfs(0)
  puts @c
end