#include<iostream>

using namespace std;

int ans = 0;
void dfs(int n,int s,int d){
	if (s < 0) return;
	if (s == 0 and n == 0){
		ans++;
		return;
	}
	if (n == 0) return;	
	d++;
	if (d == 10)return;
//	cout << "n=" << n;
//	cout << " s=" << s;
//	cout << " d=" << d <<  endl;
	//???????????´???
	dfs(n-1,s-d,d);
	//?????°????????£?????´???
	dfs(n,s,d);
return;
}

int main(){
	int n,s; cin >> n >> s;
	while (!(n == 0 and s == 0)){
		dfs(n,s,-1);
		cout << ans << endl;
		ans = 0;
		cin >> n >> s;
	}

return 0;
}