class Integers
  def initialize
    @count = 0
    @sum = 0
    @digit = 0
    @results = []
    while val = $stdin.gets do
      n, sum = val.chomp.split(' ').map(&:to_i)
      if n == 0 && sum == 0 
        break
      end
      calc(n,sum)
    end

    @results.each do |s|
      puts s
    end
  end

  def calc(n, sum)
    @sum = sum
    @digit = n
    @count = 0
    0.upto(9) do |num|
      array = []
      array[array.size] = num
      value = sum_array(array)
      if value == @sum && array.size >= @digit
        p array
        @count += 1
        break
      end
      tree(array.dup)
    end
    @results.push(@count)
  end

  def tree(array)
    size = array.size
    if size < @digit
      (array[-1]+1).upto(9) do |num|
        array[size] = num
        value = sum_array(array)
        break if value > @sum
        if value == @sum && size >= @digit-1
          @count += 1
          break
        else
          tree(array.dup)
        end
      end
    end
  end

  def sum_array(array)
    array.inject(:+)
  end
end

i = Integers.new