#include<bits/stdc++.h>
using namespace std;
int vis[20];int n,s;int ans ;


void dfs(int step,int cur,int sum)
{
    if(step == n && sum == s){
        ans++;
        return ;
    }
    if(step == n || sum > s) return;
    for(int i = cur; i <= 9 ; i++){
        if(!vis[i] && sum + i <= s){
            vis[i] = 1;dfs(step + 1,i + 1,sum + i);vis[i] = 0;
        }
    }
}





int main()
{
    ios::sync_with_stdio(0);
    while(cin >> n >> s){
        if(n == 0 && s == 0) break;
        if(s > 45) {
            cout << 0 << endl;continue;
        }
        memset(vis,0,sizeof(vis));ans = 0;
        dfs(0,0,0);cout << ans << endl;
    }
    return 0;
}
