#include<iostream>

using namespace std;

int n,s,ans;//?????????????????°??§??£?¨?????????¨dfs?????§?????§??§??????????????§??°?????????????????°??§??£?¨?

void dfs(int now,int sum,int times){//now??????????????´??° sum?????????????¨? times??????????????§????????´??°?????°
	if(n < times)//???????????´??°???n?????????????????°??????
		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;
}