#include <iostream>
#include<cstdio>

using namespace std;

int n,s;
int cnt;
 
void solve(int a,int b,int c){
    if(b==n && s==c){
        cnt++;
    }
    if(b<n){
        for(int i=a+1;i<=9;i++)solve(i,b+1,c+i);
    }
}

int main(void){
    while(1){
        scanf("%d%d",&n,&s);
        cnt=0;
        if(n==0)break;
        solve(-1,0,0);
        printf("%d\n",cnt);
    }
    return 0;
}
