#include <numeric>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
    int n,s,i,sm,cnt;
    while(1){
        scanf("%d",&n);
        scanf("%d",&s);
        if(!n && !s){break;}
        if(s<n*(n-1)/2){
            printf("0\n");
            continue;
        }

        cnt=0;
        int l[s+1],m[s+1];
        iota(l,l+s+1,0);
        for(i=0;i<s+1;i++){m[i]=0;}
        for(i=0;i<n;i++){
            m[s-i]=1;
        }
        do{
            sm=0;
            for(i=0;i<s+1;i++){
                sm+=(l[i]*m[i]);
            }
            if(sm==s){cnt++;}
        }while(next_permutation(m,m+s+1));
        printf("%d\n",cnt);
    }
    return 0;
}

