#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef vector <int> VI;
typedef vector <VI> VVI;
int main( void )
{
	int n, s;

	while ( cin >> n >> s )
	{
		VI masks;
		for ( int i = 0; i < 1 << 10; i++ )
		{
			int cnt = 0;
			for ( int j = 0; j < 10; j++ )
			{
				if ( i & 1 << j ) cnt++;
			}
			if ( cnt == n ) masks.push_back( i );
		}

		VVI as;
		VI aa(n);
		for ( int i = 0; i < n; i++ )
		{
			aa[i] = i+1;
		}
		do {
			as.push_back( aa );
		} while ( next_permutation( aa.begin(), aa.end() ) );

		int answer = 0;
		for ( VI::iterator it = masks.begin(); it != masks.end(); it++ )
		{
			int& mask = *it;
			
			VI k;
			for ( int i = 0; i < 10; i++ )
			{
				if ( mask & 1 << i ) k.push_back( i );
			}

			for ( VVI::iterator it_j = as.begin(); it_j != as.end(); it_j++ )
			{
				VI& a = *it_j;
				int sum = 0;
				for ( int i = 0; i < n; i++ )
				{
					sum += a[i] * k[i];
					if ( sum > s ) break;
				}
				if ( sum == s ) answer++;
			}
		}

		cout << answer << endl;
	}

	return 0;
}