#include using namespace std; class UnionFind{ public: vector tree; void init(){ for(int i = 0;i < tree.size();i++){ tree[i] = -1; } return; } UnionFind(int n){ n++; tree.resize(n); init(); return; } int root(int i){ if(tree[i] < 0) return i; return tree[i] = root(tree[i]); } bool unite(int i, int j){ i = root(i); j = root(j); if(i == j) return false; tree[i] += tree[j]; tree[j] = i; return true; } int size(int i){ return -tree[root(i)]; } bool same(int i, int j){ return root(i) == root(j); } }; int used[1000010] = {}; int main(){ int n, p; cin >> n >> p; UnionFind tree(n); for(int i = 2;i <= n;i++){ if(!used[i]){ for(int j = i*2;j <= n;j+=i){ tree.unite(i, j); used[i] = 1; } } } cout << tree.size(p) << endl; return 0; }