#include <algorithm>
#include <sstream>
#include <iostream>
#include <map>
#include <cstring>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;

#define rep(i,n) for(int i = 0;i<n;i++)
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main() {
	while(true){
		int s,n,sum = 0,ans = 0;
		cin >> n >> s;
		if(s + n ==0) break;
		int comb = (1 << n) - 1;
		while(comb < 1 << 10){
			sum = 0;
			for(int p = 0;p<10;p++){
				if(comb & (1 << p)){
					sum+=p;
				}
			}
			if(sum == s){
				ans++;
			}
			int x = comb & -comb, y = comb+x;
			comb = ((comb & ~y) / x >> 1)|y;
		}
		cout << ans << endl;
	}
    return 0;
}