#include <cstdio>
#include <cstring>

using namespace std;

int main(void){
	int n, s, i, j, ans, sum, num;
	while(1){
		scanf("%d%d",&n,&s);
		if(n == 0 && s == 0)
			break;
		ans = 0;
		for(i = 0;i < (1 << 10);i++){
			num = sum = 0;
			for(j = 0;j < 10;j++){
				if(1 << j & i){
					num++;
					sum += j;
				}
			}
			if(num == n && sum == s){
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}