#include <iostream>
#include <algorithm>

using namespace std;

int dfs(int st, int depth, int N, int S, int *arr) {
    if(depth == N) {
        if(st == S) return 1;
        else return 0;
    }
    int ans = 0;
    for(int i = 0; i < N-depth; ++i) {
        int n = arr[i];
        swap(arr[i], arr[N-depth-1]);
        ans += dfs(st+n*(depth+1), depth+1, N, S, arr);
        swap(arr[i], arr[N-depth-1]);
    }
    return ans;
}

int main() {
    int N, S;
    while(cin >> N >> S) {
        int pats[10];
        for(int i = 0; i < 10; ++i) pats[i] = i<N ? 1 : 0;
        reverse(pats, pats+10);

        int ans = 0;
        do {
            int list[N], *pt = list;
            for(int i = 0; i < 10; ++i)
                if(pats[i]) *pt++ = i;

            ans += dfs(0, 0, N, S, list);
        } while(next_permutation(pats, pats+10));
        cout << ans << endl;
    }
    return 0;
}