#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n, s;
    while (true)
    {
        cin >> n >> s;
        if (n == 0 && s == 0)
            break;

        int num = 0;
        rep(i, pow(2, 10))
        {
            vector<int> hoge;
            rep(j, 10)
            {
                if ((i & (1 << j)) != 0)
                    hoge.push_back(j);
            }
            int piyo = 0;
            if (hoge.size() == n)
            {
                for (auto item : hoge)
                    piyo += item;
            }
            if (piyo == s)
                num++;
        }
        cout << num << endl;
    }
    return 0;
}
