#include <iostream>

using namespace std;

int n,s;

int cou (int i,int cn, int cs){
	if(cs > s|| cn > n)
		return 0;
	if((cn == n||cn==n-1) && cs == s)
		return 1;
	int ans=0;
	
	for(;i<10;i++)
		ans+=cou(i,cn+1,cs+i);
	return ans;
}


int main(void){
	while( cin >> n >> s, n|s){
		cout << cou(1,0,0) << endl;
	}
	return 0;
}