#include #define show(x) std::cerr << #x << " = " << x << std::endl using ll = long long; template std::ostream& operator<<(std::ostream& os, const std::vector& v) { os << "["; for (const auto& p : v) { os << p << ","; } return (os << "]\n"); } int main() { int N, X; std::cin >> N >> X, X++; if (N >= 30) { return std::cout << 0 << std::endl, 0; } std::vector d; for (int i = 1; i * i <= X; i++) { if (X % i != 0) { continue; } d.push_back(i); if (i * i != X) { d.push_back(X / i); } } const int S = d.size(); std::sort(d.begin(), d.end()); std::map mp; for (int i = 0; i < S; i++) { mp[d[i]] = i; } std::vector> dp(S, std::vector(S, 0)); // 積=d[i], 最後に使った約数<=d[j] std::fill(dp[0].begin(), dp[0].end(), 1); for (int i = 0; i < N; i++) { std::vector> tmp(S, std::vector(S, 0)); for (int j = S - 1; j >= 0; j--) { for (int k = j; k >= 1; k--) { if (d[j] % d[k] == 0) { tmp[j][k] = dp[mp[d[j] / d[k]]][k]; } } } dp = tmp; for (int i = 0; i < S; i++) { for (int j = 1; j < S; j++) { dp[i][j] += dp[i][j - 1]; } } } std::cout << dp[S - 1][S - 1] << std::endl; return 0; }