import scala.io.StdIn.readLine
import scala.collection.immutable.BitSet

object Main {

  def sum(n:Int, s:Int, b:BitSet, a:Array[Array[Int]]):Int = {
    if(n==1) {
      if(s >= 0 && s<=9 && (b.isEmpty || s > b.max)) 1 else 0
    } else {
      if(a(n)(s) != -1) a(n)(s)
      else {
        var j = 0
        for(i <- 0 to 9 ){
          if(s>=i && (b.isEmpty || i > b.max))
            j += sum(n-1,s-i,b+i,a)
        }
        a(n)(s) = j
        j
      }
    }
  }

  def getSum(sb:StringBuilder):Unit = {
    val r = readLine.split(" ").map(_.toInt)

    if(r(0)==0 && r(1)==0)  print(sb.result)
    else {
      var a = Array.fill(9,101)(-1)
      println(sum(r(0),r(1),BitSet.empty,a))
      getSum(sb)
    }
  }

  def main(args:Array[String]) = getSum(new StringBuilder)
}