import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[] a;
	while (a = readln.split.map!(to!int).array, a[0]) {
		int cnt;
		bool f[10];
		
		void solve (int c, int sum, int l) {
			if (c == a[0]) {
				if (sum == a[1]) cnt++;
				return;
			}
			foreach (i; l..10) {
				if (f[i]) continue;
				f[i] = 1;
				solve(c+1, sum+i, i+1);
				f[i] = 0;
			}
		}
		solve(0, 0, 0);
		cnt.writeln;
	}
}