#include using namespace std; int main() { int n, p; cin >> n >> p; vector ps; 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()); int lpf = ps.front(); vector vis(n); for (int g = 1; g <= n; g++) { if ((int64_t)g * lpf <= n) { vis[g] = 1; } } int ans = 0; for (int i = 0; i < n; i++) ans += vis[i]; cout << ans << "\n"; }