//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
int ans;
int n;
int s;
void dfs(int now,int now2,int sum){
  if(sum==s and now==n) ans++;
  if(now==n or now2==10 or sum>s) return ;
  dfs(now,now2+1,sum);
  dfs(now+1,now2+1,sum+now2); 
}
int main(){
  for(;;){
    ans=0;
    cin>>n;
    cin>>s;
    if(n==0 and s==0)
      break;
    dfs(0,0,0);
    cout<<ans<<endl;
  }
}

