#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define _repargs(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define mod 1000000007 #define inf 2000000007 #define mp make_pair #define pb push_back typedef long long ll; using namespace std; template inline void output(T a, int p = 0) { if(p) cout << fixed << setprecision(p) << a << "\n"; else cout << a << "\n"; } // end of template vector div(ll n){ vector ret; for(ll d = 2; d * d <= n; d++) { if(n % d == 0) { ret.pb(d); if(d * d != n) ret.pb(n / d); } } ret.pb(n); sort(all(ret)); return ret; } double EPS = 0.0000000000001; vector D; // nをD[m]以上のk個の約数で分解する方法 ll dec(ll n, ll m, int k){ if(k == 0){ if(n == 1) return 1; else return 0; } if(k == 1){ if(n >= D[m]) return 1; else return 0; } if(pow(n, 1.0 / k) + EPS < D[m]) return 0; ll ret = 0; rep(d, m, D.size()){ if(n < D[d] * D[d]) break; if(n % D[d] == 0){ ll nn = n; int cnt = 1; while(nn % D[d] == 0 && k >= cnt){ nn /= D[d]; ret += dec(nn, d + 1, k - cnt); // cout << nn << ", " << D[d + 1] << ", " << k - cnt << ": " << dec(nn, d + 1, k - cnt) << endl; cnt++; } } } // cout << n << ", " << D[m] << ", " << k << ": " << ret << endl; return ret; } int main() { cin.tie(0); ios::sync_with_stdio(0); // source code int N; ll X; cin >> N >> X; D = div(X + 1); ll M = dec(X + 1, 0, N); assert(M <= 200000); output(M); return 0; }