#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

int main(){
	int n,s;
	while(cin >> n >> s){
		if(n == 0 && s == 0)break;
		int num = 0;
		for(int zero = 0; zero <= 1; zero++){
			for(int one = 0; one <= 1; one++){
				for(int two = 0; two <= 1; two++){
					for(int three = 0; three <= 1; three++){
						for(int four = 0; four <= 1; four++){
							for(int five = 0; five <= 1; five++){
								for(int six = 0; six <= 1; six++){
									for(int seven = 0; seven <= 1; seven++){
										for(int eight = 0; eight <= 1; eight++){
											for(int nine = 0; nine <= 1; nine++){
												if(zero + one + two + three + four + five + six + seven + eight + nine == n && one + two * 2 + three * 3 + four * 4 + five * 5 + six * 6 + seven * 7 + eight * 8 + nine * 9 == s)num++;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		cout << num << endl;
	}
}
