#include<iostream>
#include<bitset>
using namespace std;

void select( int* x, bitset<10> b, int n, int s, int i, int& c )
{
    if( i == 10 )
    {
        if( b.count() == n )
        {
            int sum = 0;
            for( int j = 0; j < 10; j++ )
            {
                if( b[j] == 1 )
                    sum += x[j];
            }
            if( sum == s )
                c++;
        }
        return;
    }
    b[i] = 0;
    select( x, b, n, s, i + 1, c );

    b[i] = 1;
    select( x, b, n, s, i + 1, c );
}

int main()
{
    int x[10];
    bitset<10> b;
    int n, s;

    for( int i = 0; i < 10; i++ )
        x[i] = i;

    while( cin >> n >> s )
    {
        int cnt = 0;
        if( n == 0 && s == 0 )
            break;
        select( x, b, n, s, 0, cnt );
        cout << cnt << endl;
    }

    return 0;
}
