#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	int n, s;
	while (scanf("%d %d\n", &n, &s) != EOF)
	{
		int res = 0;

		int combi[10];
		int f = (1 << n) - 1;
		do
		{
			for (int i = 0, j = 0; j < n; ++i)
			{
				if (f & (1 << i))
					combi[j++] = i;
			}

			do
			{
				int ts = 0;
				for (int i = 0; i < n; ++i)
					ts += (i+1) * combi[i];

				if (ts == s)
					++res;
			} while (next_permutation(combi, combi+n));

			// combination
			int leastBit = f & -f;
			int mostBits = f + leastBit;
			int leastSequentialBits = f & ~mostBits;
			f = mostBits | ((leastSequentialBits / leastBit) >> 1);
		} while (f < 1 << 10);

		printf("%d\n", res);
	}

	return 0;
}