#include <cstdio>
int n,s;
int dfs(int x,int y,int sum) {
	if(x==10) {
		return y==n&&sum==s;
	}
	return dfs(x+1,y,sum)+dfs(x+1,y+1,sum+x);
}
int main() {
	while(scanf("%d %d",&n,&s),n) {
		printf("%d\n",dfs(0,0,0));
	}
}