#include <iostream>
using namespace std;
int main() {
  int n, s;
  while (cin >> n >> s) {
    if (n == 0 && s == 0) break;
    int ans = 0;
    for (int i = 0; i < 1024; i++) {
      int a = 0, b = 0;
      for (int j = 0; j < 10; j++)
        if ((i >> j) & 1) {
          a += j;
          b++;
        }
      if (a == s && b == n) ans++;
    }
    cout << ans << endl;
  }
}