#include <stdio.h>
int ans, n, s;

void p(int count, int sum, int num){

	if ( sum>s || count>n ) return;

	for (int i=num+1 ; i<=9 , sum+i<=s ; i++){
		if ( (sum+i)==s && count==n ) ans++;
		p( count+1 , sum+i , i );
	}
}

int main(){
	while ( 1 ){
		ans = 0;
		scanf("%d %d", &n, &s);
		if ( n==0 && s==0 ) break;

		p( 1 , 0 , -1 );
		printf("%d\n", ans);		
	}
	return 0;
}