#include<iostream>
#include<vector>

using namespace std;

int Judge(vector<int> no, int n);

int main()
{
  int n, s, cnt, sum, i, j, k, judge;
  
  while(cin >> n >> s, (n != 0 || s != 0)) {
    vector<int> no(9);
    for(i = 0; i < n ; i++) no[i] = i;
    cnt = 0;
    while(1) {
      if(no[0] == 10) break;
      judge = Judge(no , n);
      if(judge == true) {
	for(k = sum = 0; k < n; k++) {
	  sum += no[k];
      }
	if (sum ==  s) cnt++;
      }
      no[n - 1]++;
      for(k = n - 1; k > 0; k--) {
	if(no[k] == 10) {
	  no[k] = 0;
	  no[k - 1]++;
	}
      }
    }
    cout << cnt << endl;
  }
}

int Judge(vector<int> no, int n)
{
  int i, j;
  for(i = 0; i + 1 < n; i++) {
    if (no[i] > no[i + 1]) return false;
    for(j = i + 1; j < n; j++)
      if (no[i] == no[j])
	return false;
  }
  return true;
}