Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func solve(a, b, c int) int {
	if a == 1 && b >= c && b < 10 {
		return 1
	}
	if a == 1 {
		return 0
	}
	ret := 0
	for i := c; i < 10 && i < b; i++ {
		ret += solve(a-1, b-i, i+1)
	}
	return ret
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		if a == 0 {
			break
		}
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		fmt.Println(solve(a, b, 0))
	}
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   vector<bool> i;
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n, s,ans=0;
   while(1){
      cin >> n >> s;
      ans=0;
      if(n+s==0) break;
      if(n==1) cout << 1 << endl;
      if(n==2) cout << n/2+n%2 << endl;
      if(n==3){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)if(i+j+k==s){
            ans++; break;
         }
      }
      if(n==4){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n){if(i+j+k+l==s){
            ans++; break;
         }
         if(i>s) break;
         }

      }
      if(n==5){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n){
         if(i+j+k+l+m==s){
            ans++; break;
         }
         if(i>s) break;
         }

      }
      if(n==6){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n){
         if(i+j+k+l+m+o==s){
            ans++; break;
         }
            if(i>s) break;
         }
      }
      if(n==7){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n){if(i+j+k+l+m+o+p==s){
            ans++; break;
         }
            if(i>s) break;
         }
      }
      if(n==8){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n)FOR(q,p+1,108-n){
            if(i+j+k+l+m+o+p+q==s){
               ans++; break;
            }
            if(i>s) break;
         }
      }
      if(n==9){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n)FOR(q,p+1,108-n)FOR(r,q+1,109-n){
            if(i+j+k+l+m+o+p+q+r==s){
               ans++; break;
            }
            if(i>s) break;
         }
      }
      
      cout << ans << endl;
   }
}

C++: #include <iostream>
using namespace std;
void partialSum(int& c, int i, int k, int n, int s, int sum)
{
	if (k == n && s == sum){
		++c;
		return;
	}
	if (i > 9 || k > n || sum > s)
		return;

	partialSum(c, i + 1, k, n, s, sum);
	partialSum(c, i + 1, k + 1, n, s, sum + i);
}
int main()
{
	int n, s, c, i, k, sum;
	while (cin >> n >> s){
		if (0 == s && 0 == n) break;
		c = i = k = sum = 0;
		partialSum(c, i, k, n, s, sum);
		cout << c << "\n";
	}
	return 0;
}

C++: #include <iostream>
using namespace std; 
int dfs(int n, int s, int x)
{
   int sum=0;
   if(n==0 && s==0)
   return 1;
   if(n>0){
       for(int i=x; i<10; i++){
           if(s-i>=0) sum+=dfs(n-1, s-i, i+1);
       }
   }
   return sum;
}
 int main(void)
{
   int n, s;
   while(cin >> n >> s)
{
       if(n==0 && s==0)
   break;
       cout << dfs(n, s, 0) << endl;
   }
   return 0;
}

C++: #include <iostream>
using namespace std;

int n,k,count;
int value[10] = {0,1,2,3,4,5,6,7,8,9};

void dfs(int i,int sum,int num)
{
	if(num == n && sum == k) 
	{
		count++;
		return;
	}

	if(i == 10 || num == n)
	{
		return;
	}
	
	dfs(i+1,sum,num);
	dfs(i+1,sum + value[i],num+1);
}
int main()
{
	while(cin >> n >> k && n && k)
	{
		count = 0;
		dfs(0,0,0);
		cout << count << endl;

	}
	return 0;
}

C++: // 2019/05/02 Tazoe

#include <iostream>
using namespace std;

int cnt;

void DFS(int n, int s, int m)
{
	if(n==0 && s==0){
		cnt++;
		return;
	}

	if(n<=0)
		return;
	if(s<0)
		return;
	if(m>9)
		return;

	DFS(n-1, s-m, m+1);
	DFS(n, s, m+1);

	return;
}


int main()
{
	while(true){
		int n, s;
		cin >> n >> s;

		if(n==0 && s==0)
			break;

		cnt = 0;

		DFS(n, s, 0);

		cout << cnt << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int dfs(int x,int n,int s){
  
  if(n==0){
    return (s==0);
  }
    
  if(x==10)
    return 0;
  
  int res=0;
  
  for(int i=x;i<=9;++i){
    res+=dfs(i+1,n-1,s-i);
  }
  return res;
}

int main(){
  int n,s;

  while(cin>>n>>s,n!=0 || s!=0){
    cout<<dfs(0,n,s)<<endl;
  }
}

C++: #include <iostream>
#define DEBUG false
using namespace std;

int s;
int cmb;
void count( int n ,int k,int sa ){
  if( DEBUG )
    cout << "n="<<n<<" k="<< k << " sa="<<sa 
	 << " cmb="<<cmb << endl;


  if( n<1 && sa==s ){ ++cmb; return; }
  --n;
  for( int i=k;i<=9;i++ ){
    if( sa+i > s)
      break;
    if( DEBUG )
      cout << " i="<<i<<endl;
    count( n,i+1, sa+i );
  }
}


int main(){
  int n;
  while( cin>>n>>s && (n||s) ){
    if( DEBUG )
      cout << "\nn="<<n<<" s="<<s << endl;
    cmb = 0;
    count( n,0,0 );
    cout << cmb << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<set>

int sum_comb(std::set<int> c, int n, int s) {
	int sum = 0;
	if (n == 0) {
		if (s == 0) return 1;
		else return 0;
	}

	for (int i = c.size() == 0 ? 9 : (*(c.begin())) - 1; i >= 0; --i) {
		if (i <= s) {
			c.insert(i);
			sum += sum_comb(c, n - 1, s - i);
		}
	}
	return sum;
}

int main() {
	int n, s;
	while (std::cin >> n >> s) {
		if (n == 0 && s == 0) break;
		std::set<int> c;
		std::cout << sum_comb(c, n, s) << std::endl;
	}
	return 0;
}