#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; struct UnionFind { const int n; V<> t; // root ? -sz : par UnionFind(int n) : n(n), t(n, -1) {} int find(int v) { return t[v] < 0 ? v : t[v] = find(t[v]); } void unite(int u, int v) { if ((u = find(u)) == (v = find(v))) return; if (-t[u] < -t[v]) swap(u, v); t[u] += t[v]; t[v] = u; } bool same(int u, int v) { return find(u) == find(v); } int size(int v) { return -t[find(v)]; } }; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, p; cin >> n >> p; UnionFind uf(n + 1); for (int d = 2; d <= n; ++d) { for (int i = 2 * d; i <= n; i += d) { uf.unite(d, i); } } cout << uf.size(p) << '\n'; }