# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <tuple>
# include <functional>
# include <utility>
# define INF 1000000000
# define MOD 1000000000+7
using namespace std;

int n, s;
int ans;
int dfs(int sum, int count, int num) {
	if (num > 9) {
		return 0;
	}
	if (count == n) {
		if (s == sum) {
			ans++;
		}
		return 0;
	}
	dfs(sum + num, count + 1, num + 1);
	dfs(sum, count, num + 1);
	return 0;
}

int main() {
	while (cin >> n >> s&&n != 0 && s != 0) {
		ans = 0;
		dfs(0, 0, 0);
		cout << ans << endl;
	}
}