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

int cou;
int n,s,k=9;
void sum(int right, int left, int loop_c){
	if( left < 0 ) return;
	if( right < 0 ) return;
	if( right == 0 && loop_c == 0) cou++;
	sum( right-left , --left, --loop_c);
	sum( s , left , n );
}

int main(void){
	while(cin>>n>>s)
    {
        if( n == 0 && s == 0 ) break;
        sum(s,9,n);
        cout<<cou<<endl;
        cou=0;
    }
	return 0;
}