#include using namespace std; main(){ int n,x; scanf("%d%d",&n,&x); ++x; vector v; for(int i=2;i*i<=x;){ if(x%i==0){ v.push_back(i); x/=i; }else{ ++i; } } v.push_back(x); int r=0; if(v.size()>=n){ multiset m; for(int i=0;i> s1,s2; s1.insert(m); for(int vi:v){ for(multiset const& m1:s1){ int l=0; for(int a:m1){ if(a!=l){ l=a; multiset m2=m1; m2.erase(m2.find(a)); m2.insert(a*vi); s2.insert(m2); } } } s1.swap(s2);s2.clear(); } for(multiset const& m1:s1){ r+=m1.find(1)==m1.end(); } } printf("%d\n",r); }