#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'; }