#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
// i --> 9?????§?????°???
// sum --> ????¨????
// cnt --> S??¨??????????????°
// total --> ?¶????????????°(N????????§?¶????)
int N, S, cnt;
void func( int i, int sum, int total )
{
	//N???????????????????????? ?????? ????¨????S?????????????????????count??????
	if( total == N && sum == S )
	{
		cnt++;
		return;
	}
	//0-9?????§??¢?´¢????????? or ?¶?????????°???N?????????????????? ?????????
	if( i == 10 || total == N ) return;
	
	//????¨???? i ????¶??????´??? -> ?¶?????????°??? +1 ??????
	func( i + 1, sum + i, total + 1 );
	//????¨???? i ????¶????????????´???
	func( i + 1, sum, total );
}
int main()
{
	while( cin >> N >> S )
	{
		if( N == 0 && S == 0 ) break;
		cnt = 0;
		func( 0, 0, 0 );
		cout << cnt << endl;
	}
	return 0;
}