#include <bits/stdc++.h>
using namespace std;

int N, S, cnt;
void dfs( int i, int sum, int total )
{
    if( total == N && sum == S )
    {
        cnt++;
        return;
    }
    if( i == 10 || total == N ) return;
    
    dfs( i + 1, sum + i, total + 1 );
    dfs( i + 1, sum, total );
}
int main()
{
    while( cin >> N >> S )
    {
        if( N == 0 && S == 0 ) break;
        cnt = 0;
        dfs( 0, 0, 0 );
        cout << cnt << endl;
    }
    return 0;
}
