#include #include #include #include #include using namespace std; const int MAX_N = 2e6; vector getPrimes(int n) { vector isPrime(n+1, true); isPrime[0] = isPrime[1] = false; for (int i = 2; i * i <= n; i++) { if (isPrime[i]) { for (int j = i * 2; j <= n; j += i) { isPrime[j] = false; } } } vector primes(n + 1, 0); int idx = 0; for (int i = 0; i <= n; i++) { if (isPrime[i]) { primes[idx] = i; idx++; } } primes.erase(primes.begin() + idx, primes.end()); return primes; } int main() { int n, k; cin >> n >> k; auto primes = getPrimes(n); int np = primes.size(); long long mini = 1; for (int i = 0; i < k; i++) { mini *= (long long) primes[i]; if (mini > MAX_N || mini > n) { cout << 0 << endl; return 0; } } int ans = 1; // miniはOK for (int i = mini + 1; i <= n; i++) { int num = i; int n_use = 0; for (int j = 0; j < np; j++) { bool used = false; while (num % primes[j] == 0) { used = true; num /= primes[j]; } if (used) { n_use++; if (n_use >= k) { ans++; break; } } } } cout << ans << endl; return 0; }