#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REP(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;
const int MAX = 101;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int bit[1 << 9][1000];

int dfs(int used, int s, int n, int times, int count){
	if (bit[used][s]){
		return bit[used][s];
	}
	if (count == n){
		return bit[used][s] = (!s) ? 1 : 0;
	}

	int res = 0;
	int num = -1;
	for (int i = 1; i < (1 << 9); i <<= 1){
		num++;
		if (used & i) continue;
		res += dfs(used | i, s - (num * times), n, times + 1, count + 1);
	}

	return bit[used][s] = res;
}

int main(){
	int n, s;
	while (cin >> n >> s){
		if (cin.eof()) break;
		memset(bit, 0, sizeof(bit));
		cout << dfs(0, s, n, 1, 0) << endl;
	}
}