#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) #if defined(_MSC_VER) || __cplusplus > 199711L #define aut(r,v) auto r = (v) #else #define aut(r,v) __typeof(v) r = (v) #endif #define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it) #define all(o) (o).begin(), (o).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset(m,v,sizeof(m)) #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template inline void amin(T &x, U y) { if(y < x) x = y; } template inline void amax(T &x, U y) { if(x < y) x = y; } vector primes; vector smallestPrimeFactor; void linearSieve(int n) { if(n < 1) n = 1; if((int)smallestPrimeFactor.size() >= n+1) return; int primePiBound = n < 20 ? n - 1 : (int)(n / (log(n * 1.) - 2) + 2); primes.assign(primePiBound + 1, numeric_limits::max()); int P = 0; smallestPrimeFactor.assign(n + 1, 0); smallestPrimeFactor[1] = 1; int n2 = n / 2, n3 = n / 3, n5 = n / 5; if(n >= 2) primes[P ++] = 2; if(n >= 3) primes[P ++] = 3; for(int q = 2; q <= n; q += 2) smallestPrimeFactor[q] = 2; for(int q = 3; q <= n; q += 6) smallestPrimeFactor[q] = 3; for(int q = 5; q <= n5; q += 2) { if(smallestPrimeFactor[q] == 0) primes[P ++] = smallestPrimeFactor[q] = q; int bound = smallestPrimeFactor[q]; for(int i = 2; ; ++ i) { int p = primes[i]; if(p > bound) break; int pq = p * q; if(pq > n) break; smallestPrimeFactor[pq] = p; } } for(int q = (n5 + 1) | 1; q <= n; q += 2) { if(smallestPrimeFactor[q] == 0) primes[P ++] = smallestPrimeFactor[q] = q; } primes.resize(P); } int main() { int N; int K; while(~scanf("%d%d", &N, &K)) { linearSieve(N); vi num(N+1); rer(n, 2, N) { int p = smallestPrimeFactor[n], x = n; while(x % p == 0) x /= p; num[n] = num[x] + 1; } int ans = 0; rer(n, 2, N) ans += num[n] >= K; printf("%d\n", ans); } return 0; }