#include /* #include #include namespace mp = boost::multiprecision; using bint = mp::cpp_int; */ #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for (int i = 0; i < int(n); ++i) #define repp(i,n,m) for (int i = m; i < int(n); ++i) using namespace std; using namespace atcoder; using namespace internal; //alias g++='g++ -I/mnt/c/Users/Owner/Desktop/ac-library' using ll = long long; using ld = long double; using P = pair; using PI = pair,int>; using PL = pair; using PLL = pair, long long>; using Pxy = pair; const int INF = 1001001007; const int modd = 1000000007; const long long modl = 1000000007LL; const long long mod = 998244353LL; const ll inf = 2e18; template void priv(vector &ar){ if (ar.size() == 0) cout << endl; else { rep(i,ar.size()-1) cout << ar[i] << " "; cout << ar[ar.size()-1] << endl; } } template void privv(vector> &ar){ rep(i,ar.size()){ rep(j,ar[i].size()-1) cout << ar[i][j] << " "; cout << ar[i][ar[i].size()-1] << endl; } } template bool range(SC a, SC b, SC x){return (a <= x && x < b);} bool rrange(P a, P b, P xy){ bool s = range(a.first,b.first,xy.first); bool t = range(a.second,b.second,xy.second); return (s && t); } template void sor(vector &ar){sort(ar.begin(),ar.end());} template void rev(vector &ar){reverse(ar.begin(),ar.end());} template bool chmin(SF &a, const SF &b){if(a>b){a = b; return true;} return false;} template bool chmax(SG &a, const SG &b){if(a void eru(vector &ar){sor(ar);ar.erase(unique(ar.begin(),ar.end()),ar.end());} template SI last(vector &ar){return ar[ar.size()-1];} template SJ cel(SJ a, SJ b){if (a % b == 0) return a/b; return a/b +1;} template void pout(pair p) {cout << p.first << " " << p.second << endl;} void yes(){cout << "Yes" << endl;} void no (){cout << "No" << endl;} void yn (bool t){if(t)yes();else no();} void Yes(){cout << "YES" << endl;} void No (){cout << "NO" << endl;} void YN (bool t){if(t)Yes();else No();} void dout() {cout << setprecision(20);} vector dx = {0,1,0,-1}; vector dy = {1,0,-1,0}; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string alp = "abcdefghijklmnopqrstuvwxyz"; ll gcds(ll a, ll b){ ll c = a % b; while (c != 0){ a = b; b = c; c = a % b; } return b; } ll cnt(vector &ar, ll x){ ll le = -1; ll ri = ar.size(); ll mid = (le + ri) / 2; while (ri - le > 1){ if (ar[mid] <= x) le = mid; else ri = mid; mid = (le + ri) / 2; } return le + 1; } ll slv(vector &ar, ll n, ll k, map &mp){ if (mp.find(PL(n,k)) != mp.end()) return mp[PL(n,k)]; if (n == 13) return mp[PL(n,k)] = cnt(ar,k); if (k == 1) return mp[PL(n,k)] = 2; if (n > k) return mp[PL(n,k)] = slv(ar,max(13LL,k),k,mp); return mp[PL(n,k)] = slv(ar,n-1,k,mp) + slv(ar,n-1,k/n,mp); } int main(){ int n; cin >> n; ll k; cin >> k; vector kai(14,1); repp(i,14,2) kai[i] = kai[i-1] * i; if (n <= 13){ vector ar(1<> j & 1) h *= j+1; ar[i] = h; } sor(ar); cout << cnt(ar,k) - 1 << endl; } else { vector ar(1<<13); rep(i,1<<13){ ll h = 1; rep(j,13) if (i >> j & 1) h *= j+1; ar[i] = h; } sor(ar); map mp; cout << slv(ar,n,k,mp) - 1 << endl; } }