#include <iostream>
#include <vector>
using namespace std;

int t;
int num[10];

void sousa(int a, int b){
	for(num[a-1] = num[a]-1; num[a-1] >= 0; num[a-1]--){
		if(a-1 < 0 || b < 0){
			break;
		}
		else if(a-1 == 0 && b-num[a-1] == 0){
			t++;
			break;
		}
		else{
			sousa(a-1, b-num[a-1]);
		}
	}
}
int main(){
	vector<int> array;
	int n, m;
	while(cin >> n >> m){
		if(n == 0 && m == 0){
			break;
		}
		if(m > 45){
			array.push_back(0);
			continue;
		}
		t = 0;
		num[n] = 9;
		sousa(n, m);
		array.push_back(t);
	}
	for(int i = 0; i < array.size(); i++){
		cout << array[i] << endl;
	}
}