#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("popcnt,bmi2,fma,fma4,avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #include using ll = long long; std::unordered_map memo[202]; ll dp(int n, ll k) { if (k == 0) return 0; if (n == 0) return 1; if (memo[n].count(k)) return memo[n][k]; return memo[n][k] = dp(n-1, k) + dp(n-1, k/n); } int main() { ll n, k; std::cin >> n >> k; std::cout << (dp(n, k) - 1) << '\n'; }