#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define mt make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; ll f(ll a, int k) { static const ll LIM = 2000000000ll; ll x = 1; if(a > 100) { for(int i = 0; i < k&&x < LIM; ++i)x *= a; } else { while(k) { if(k & 1)x *= a; a *= a; k >>= 1; if(a > LIM && k) { x = LIM; break; } } } return x - 1; } int N, ans = 0; void g(int x, int lb, int k) { if(k == N-1) { if(x >= lb)ans++; return; } // if(f(lb, N - k) > x)return; for(int i = lb; (ll)i*i < x; ++i) { if((x - i) % (i + 1) == 0) { int j = (x - i) / (i + 1); if(f(i, N - k - 1) > j)break; g(j, i, k + 1); } } } int main(){ ios::sync_with_stdio(false); cin.tie(0); int X; cin >> N >> X; g(X, 1, 0); cout << ans << endl; }