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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int n, s;
int a[10];

int combi(int i, int s, int t)
{
    if (s == 0 && t == n)
        return 1;
    if (i == 10 || t == n)
        return 0;

    return combi(i + 1, s, t) + combi(i + 1, s - a[i], t + 1);
}
int main()
{
    rep(i, 10) a[i] = i;

    while (cin >> n >> s, n)
    {

        OP(combi(0, s, 0));
    }

    return 0;
}
