#include <cstdio>
#include <cstring>
bool used[10];
int n,s;
int dfs(int x,int y,int sum) {
	if(x==n) return (sum==s);
	if(sum>=s) return 0;
	int ret=0;
	for(int i=y+1;i<=9;i++) {
		ret+=dfs(x+1,y,sum);
		if(!used[i]) {
			used[i]=true;
			ret+=dfs(x+1,i,sum+i);
			used[i]=false;
		}
	}
	return ret;
}
int main() {
	while(scanf("%d %d",&n,&s),n|s) {
		memset(used,0,sizeof(used));
		printf("%d\n",dfs(0,-1,0));
	}
}