#include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;

int main(){
	int n,s;
	while(cin >> n >> s and (n or s) ){
		int ans = 0;
		for(int i = 0 ; i < (1<<10) ; i++){
			int c = 0;
			int k = 0;
			for(int j = 0 ; j < 10 ; j++)
				if( i >> j & 1 ) c++, k += j;
			if( c == n and s == k ){
				ans++;
			}
		}	
		cout << ans << endl;	
	}
			
}