#include<iostream>
#include<vector>
using namespace std;

int n, s;
vector<int> nums;

int solve( int sum, int nn, int l ){
	if( nn==0 )	return (sum == s)?1:0;
	int cnt=0;
	for( int i=l+1; i<=9-nn; i++ ){
		cnt += solve( sum+i, nn-1, i );
	}
	return cnt;
}

int main(){
	for( int i=0; i<=9; i++ )	nums.push_back(i);
	while( cin >> n >> s, n||s ){
		cout << solve( 0, n, -1 ) << endl;
	}
	return 0;
}