#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, s;
    while(cin >> n >> s, n | s)
    {
        set<vector<int>> st;
        for(int bit = 0; bit < (1<<10); bit++)
        {
            vector<int> v;
            int sum = 0;
            for(int i = 0; i < 10; i++)
            {
                if(bit & (1<<i))
                {
                    v.push_back(i);
                    sum += i;
                }
            }
            if(sum == s && v.size() == n)
            {
                sort(v.begin(), v.end());
                st.insert(v);
            }
        }
        cout << st.size() << endl;
    }
    return 0;
}


