#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<(b);++i)

int n, s;
int ans = 0;

int main() {
	while (true) {
		ans = 0;
		cin >> n >> s;
		if (n == 0)return 0;

		rep(bit, 0, (1 << 10)) {
			vector<int> a;
			rep(i, 0, 10) {
				if (bit & (1 << i))a.push_back(i);
			}

			if (a.size() == n) {
				int sum = 0;
				rep(i, 0, n) {
					sum += a[i];
				}
				if (sum == s)ans++;
				
			}
			
		}
		cout << ans << endl;
	}
}
