#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <utility>

#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cstdint>

using namespace std;

typedef long long ll;

inline int sm(unsigned int a) {
	int ret = 0;
	for(int i = 0;i < 10;i++)
		if((a>>i)&1) ret += i;
	return ret;
}

inline int cnt(unsigned int a) {
	int ret = 0;
	for(int i = 0;i < 10;i++)
		if((a>>i)&1) ret += 1;
	return ret;
}

int main(int argc,char** argv) {
	int n,s;
	cin >> n >> s;
	while(n | s) {
		unsigned int r = 1<<10;
		int c = 0;
		for(unsigned int i = 0;i < r;i++)
			if(sm(i) == s && cnt(i) == n) c++;
		cout << c << endl;
		cin >> n >> s;
	}
}

