#include using namespace std; int main() { int n, p; cin >> n >> p; vector ps; vector vis(n + 1), lpf(n + 1, -1), fs(n + 1); for (int64_t x = 2; x * x <= p; x++) { if (p % x == 0) { while (p % x == 0) { ps.push_back(x); p /= x; } } } if (p != 1) ps.push_back(p); ps.erase(unique(ps.begin(), ps.end()), ps.end()); for (int x : ps) vis[x] = 1; for (int p = 2; p <= n; p++) { if (lpf[p] != -1) continue; for (int q = p; q <= n; q += p) { if (lpf[q] == -1) lpf[q] = p; } } for (int i = 0; i < (int)ps.size(); i++) { int p = ps[i]; for (int q = p; q <= n; q += p) { int s = q / p; fs[q] = 1; if (lpf[s] == s && !vis[s]) { vis[s] = 1; ps.push_back(s); } } } int ans = 0; for (int i = 1; i <= n; i++) ans += fs[i]; cout << ans << "\n"; }