#include #include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; template vector divisor(T n){ vector ret; for(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(begin(ret), end(ret)); return(ret); } int main() { int n, x; cin >> n >> x; x++; int ans = 0; auto v = divisor(x); map p; int m = v.size(); vector> divisors(m); for (int i = 0; i < m; ++i) { p[v[i]] = i; for (int j = 0; j <= i; ++j) { if(v[i]%v[j] == 0) divisors[i].emplace_back(v[j]); } } auto dfs = [&](int x, int dep, int ub, auto &&f) -> void { if(x == 1) { if(dep == n) ans++; return; } int q = p[x]; for (int i = 1; i < divisors[q].size(); ++i) { if(ub < divisors[q][i]) return; f(x/divisors[q][i], dep+1, divisors[q][i], f); } }; dfs(x, 0, x, dfs); cout << ans << "\n"; return 0; }