#include<iostream>
#include<algorithm>
using namespace std;

int n,s;
int cnt;

void solve(int a,int b,int c){
  if(a == n && b == s){
    cnt++;
    return;
  }
  if(b >= s) return;
  if(n <= a) return;
  if(n-1 == a && s-b < c) return;

  for(int i=c;i<10;i++) solve(a+1,i,i+1);
}

int main(){

  while(true){
    cin >> n >> s;
    if(!n && !s) break;

    cnt = 0;
    solve(0,0,0);

    cout << cnt << endl;
  }

}