#include <iostream>
#include <algorithm>
#include <map>

#define mp(x, y) make_pair(x, y)
#define ALL(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define each(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)

using namespace std;

typedef long long LINT;

const LINT MAX = 10;

int N, S;
map<int, LINT> d[1 << MAX][MAX];
map<int, int> ans[MAX+1];

int bit ( int n )
{
    int res = 0;
    for (int i = 0; i < MAX; ++i) {
        if (n & (1 << i)) { ++res; }
    }
    return res;
}

int main ( void )
{
    for (int i = 0; i < MAX; ++i) {
        int state = 1 << i;
        d[state][i].insert(mp(i, 1));
        ans[1][i] = 1;
    }
    for (int state = 1, I = 1 << MAX; state < I; ++state) {
        int b = bit(state);
        for (int i = 0; i < MAX; ++i) {
            if (!(state & (1 << i))) {
                int next = state | (1 << i);
                for (int j = 0; j < MAX; ++j) {
                    if (state & (1 << j)) {
                        each(d[state][j], p) {
                            LINT num = i * (b+1) + (*p).first;
                            d[next][i][num] += (*p).second;
                            ans[b+1][num] += (*p).second;
                        }
                    }
                }
            }
        }
    }
    while (cin >> N >> S) {
        int out;
        if (N > 10 || S > 330) { out = 0; }
        else { out = ans[N][S]; }
        cout << out << endl;
    }
    return 0;
}