#include <iostream>
using namespace std;

int bit_count( const int n )
{
	int cnt = 0;
	int tmp = n;
	while ( tmp )
	{
		cnt ++;
		tmp &= tmp - 1;
	}
	return cnt;
}

int main( void )
{
	int d[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	int n, s;
	while ( cin >> n >> s && n && s )
	{
		int answer = 0;
		for ( int i = 0; i < 1 << 10; i++ )
		{
			if ( bit_count( i ) == n )
			{
				int sum = 0;
				for ( int j = 0; j < 10; j++ ) if ( i & ( 1 << j ) ) sum += d[j];
				if ( sum == s ) answer++;
			}
		}
		cout << answer << endl;
	}

	return 0;
}