#include<iostream>

using namespace std;

int n,s,ans;

void dfs(int now,int sum,int times){
	if(n < times)
		return;
	if(n == times && s == sum){
		ans++;
		return;
	}
	for(int i = now + 1;i <= 9;i++)
		dfs(i,sum + i,times + 1);
}

int main(){
	while(cin >> n >> s,n+s != 0){
		ans = 0;
		for(int i = 0;i <= 9;i++){
			dfs(i,i,1);
		}
		cout << ans << endl;
	}
	return 0;
}