#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int n, s;

int dst(int i, int sum, int k){
    if (sum == s && k == n) return 1;
    if (i >= 10 || sum > s || k >= n) return 0;
    return dst(i+1, sum+i, k+1) + dst(i+1, sum, k);
}

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