#include<iostream>
using namespace std;
typedef long long int ll;

#define rep(i,n) for(ll i = 0;i < n;++i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while(true){
                ll n,s;
                ll ans = 0;
                cin >> n >> s;
                if(n==0&&s==0)break;
                ll shift = 1 << 10;
                rep(tem,shift){
                        ll sum = 0;
                        ll count = 0;
                        rep(i,10){
                                if(tem>>i & 1){
                                        sum+=i;
                                       count++;
                                }
                        }
                        if(sum == s && count == n)ans++;
                }
                cout << ans << endl;
        }
        return 0;
}
