#include<iostream>

using namespace std;

int ans = 0;
void dfs(int n,int s,int depth){
	//if (s < 0) return;  //
	if (s == 0 and n == 0){ // ?§£??????????????£??????
		ans++;
		return;
	}
	if (n == 0) return;	

	depth++;
	if (depth == 10)return;
	//???????????´???
	dfs(n-1,s-depth,depth);
	//?????°????????£?????´???
	dfs(n,s,depth);
return;
}

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

return 0;
}