#include <iostream>
using namespace std;
int n,m;
int ans;
void dfs(int sum,int i,int n){
  if(n == 0 && sum == m){
    ans++;
    return;
  } 
  if(n == 0 || i == 10)return; 
  dfs(sum,i+1,n);
  dfs(sum+i,i+1,n-1);
}
int main(){
  while(cin >> n >> m,n){
    ans = 0;
    dfs(0,0,n);
    cout << ans << endl;
  }
}