#include <cstdio>

using namespace std;

int next[11], n, s, r, t;

void rec(int c) {
  if (c > n) {
    if (t == s)
      r++;
    return;
  }
  if (t > s)
    return;
  for (int p, i = 0;;) {
    p = i;
    i = next[p];
    if (i == -1) break;
    t += c * (i - 1);
    next[p] = next[i];
    rec(c + 1);
    t -= c * (i - 1);
    next[p] = i;
  }
}

int main() {
  for (int i = 0; i < 10; i++)
    next[i] = i + 1;
  next[10] = -1;
  while (scanf("%d%d", &n, &s) == 2) {
    r = t = 0;
    rec(1);
    printf("%d\n", r);
  }
  return 0;
}