#include<iostream>
using namespace std;
int solve(int n,int m){
  if(n==1)return (0<=m&&m<=9);
  int res=solve(n-1,m-n+1);
  if(m-n>=0)res+=solve(n,m-n);
  if(m>=10)res-=solve(n,m-10);
  return res;
}
int main(){
  int n,m;
  while(cin>>n>>m&&n&&m){
    cout<<solve(n,m)<<endl;
  }
  return 0;
}