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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int n, int s) {
    int ans = 0;
    for (int i = 0; i < (1 << 10); i++) {

        int sum = 0;
        int take = 0;
        for (int j = 0; j < 10; j++) {
            if (i & (1 << j)) {
                sum += j;
                take++;
            }
        }

        if (sum == s && take == n) {
            ans++;
        }
    }
    return ans;
}

void main() {
    while (true) {
        auto xs = readints;
        int n = xs[0], s = xs[1];

        if (n == 0 && s == 0) break;
        writeln(calc(n, s));
    }
}
