#include <iostream>
using namespace std;

int N, S, CNT = 0;

void dfs(int i, int sum, int total){
	if(total == N && sum == S){
		CNT++;
		return;
	}
	if(i == 10 || total == N){
		return;
	}
	
	dfs(i+1,sum+i,total+1);
	dfs(i+1,sum,total);
}

int main(){
	
	while(cin >> N >> S){
		if(N == 0 && S == 0) break;
		
		CNT = 0;
		dfs(0,0,0);
		cout << CNT << endl;
		
	}
	
	return 0;
}