#include <iostream>
using namespace std;

long long ct, n, s;

void sum(long long m, long long i, long long n){
    if (n == 0 && m == s){
          ct++;
              return;
                }
      if (n == 0 || i == 10)  return;
        sum(m, i + 1, n);
          sum(m + i, i + 1, n - 1);
}

int main()
{
    while (cin >> n >> s, n){
          ct = 0;
              sum(0, 0, n);
                  cout << ct << endl;
                    }
      return (0);
}