import java.util.Scanner

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val list = mutableListOf<Int>()
	while (true){
		val n = scanner.nextInt()
		val s = scanner.nextInt()
		if (n==0 && s==0) break
		else list.add(rec(s, n, 0))
	}
	list.forEach(::println)
}

fun rec(sum: Int, cnt: Int, min: Int): Int{
	if (cnt+min-1>9) return 0
	if (sum !in (2*min+cnt-1)*cnt/2..(18-cnt+1)*cnt/2) return 0
	if (cnt==1) return if (sum in min..9) 1 else 0
	var a = 0
	for (i in min..9) {
		a+= rec(sum-i, cnt-1, i+1)
	}
	return a
}
