#include using namespace std; #define rep_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; ++i) #define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) using ll = long long; int main() { ll n, k; cin >> n >> k; unordered_map dp; dp[k] = 1; for (; n; --n) for (auto [x, y] : unordered_map(dp)) if (x >= n) dp[x/n] += y; ll ans = -1; for (auto [x, y] : dp) if (x) ans += y; cout << ans << '\n'; }