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

object Main {

  def sum(n:Int, s:Int, b:BitSet):Int = {
    if(n==1) {
      if(s >= 0 && s<=9 && (b.isEmpty || s > b.max)) 1 else 0
    } 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)
      }
      j
    }
  }

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

    if(r(0)==0 && r(1)==0)  print(sb.result)
    else {
      println(sum(r(0),r(1),BitSet.empty))
      getSum(sb)
    }
  }

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