#include<iostream>
using namespace std;
#define MAX_N 10

void loop(int deep, int sum);
void resetUse();

int ans = 0, n, s;
bool use[MAX_N];

int main(){
    while(cin >>n >>s){
        ans = 0;
        resetUse();
        loop(1, 0);
        cout <<ans <<endl;
    }
    return 0;
}

void resetUse(){
    for(int i = 0; i < MAX_N; i++){
        use[i] = false;
    }
}

void loop(int deep, int sum){
    if(deep > n + 2){
        
    } else if(s == sum && deep == n + 1){
        ans++;
    } else{
        for(int i = 0; i < MAX_N; i++){
            if(use[i] == false){
                use[i] = true;
                loop(deep + 1, deep * i + sum);
                use[i] = false;
            }
        }
    }
}

//0, 01:01:44