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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP				make_pair
#define X				first.first
#define Y				first.second

typedef pair<int, int> P;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

int n, s, ans;

bool dfs( int i, int sum, int cnt ) {

	if( i == 10 || cnt == n + 1 ) return false;
	if( sum == s && cnt == n ) return true;

	if( dfs( i + 1, sum + i, cnt + 1 ) ) ans++;
	dfs( i + 1, sum, cnt );
	
}

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