#include <bits/stdc++.h> using namespace std; vector<int64_t> divisors(int64_t n) { vector<int64_t> ret; for (int64_t i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) { ret.push_back(n / i); } } } sort(ret.begin(), ret.end()); return ret; } vector<int64_t> ds; map<tuple<int, int, int>, int> mp; int f(int N, int X, int pre) { tuple<int, int, int> key(N, X, pre); if (mp.count(key)) return mp[key]; if (N == 0) return X == 1; int t = X; for (int i = 0; i < N; i++) { t /= pre; } if (t == 0) return 0; int ret = 0; for (int d : ds) { if (d >= pre && X % d == 0) { ret += f(N - 1, X / d, d); } } return mp[key] = ret; } int main() { int N, X; cin >> N >> X; if (N > 31) { cout << 0 << endl; return 0; } ds = divisors(X + 1); cout << f(N, X + 1, 2) << endl; }