#include #include #include using namespace std; class UnionFind{ private: vector p,s; public: UnionFind(){} UnionFind(int N){ p = s = vector(N+1,0); for(int i=1;i<=N;i++){ p[i] = i; s[i] = 1; } } int find(int x){ if(p[x]==x) return x; else return p[x] = find(p[x]); } void unite(int x,int y){ x = find(x); y = find(y); if(x==y) return; if(s[x]>s[y]){ p[y] = x; s[x] += s[y]; }else{ p[x] = y; s[y] += s[x]; } } bool is_same_set(int x,int y) {return find(x)==find(y);} int size(int x) {return s[find(x)];} }; int N,P; int main(){ cin >> N >> P; UnionFind uf(N); for(int i=2;i<=N;i++) for(int j=1;i*j<=N;j++) uf.unite(i,i*j); cout << uf.size(P) << endl; }