#!/usr/local/bin/ruby
while (line=gets)!="0 0\n"
  arr=line.split(" ").map(&:to_i)
  n=arr[0].to_i
  s=arr[1].to_i
  ans=0
  i=[0,1,2,3,4,5,6,7,8,9]
  j=i.combination(n)
  p=1
  q=1
  for m in 1..n
    p=p*m
  end 
  10.downto(10-n) do |b|
    q=q*b
  end
  sum=q/p
  for s in 0..(sum-1)
    if j[sum]==s
      ans+=1
    end
  end
  puts "#{ans}"
end