import std.stdio, std.algorithm, std.conv, std.string;

void main()
{
    foreach(input; stdin.byLine().map!(line => line.split.map!(to!int)))
    {
        if(input[0] == 0) break;
        solve(input[0], input[1], 0).writeln;
    }
}

int solve(int numDigits, int sum, int min)
{
    int combinations;

    if(sum < min || numDigits <= 0) return 0;
    else if(numDigits == 1) return min <= sum && sum <= 9 ? 1 : 0;

    foreach(i; min..10)
    {
        combinations += solve(numDigits - 1, sum - i, i + 1);
    }

    return combinations;
}