void gen_primelist(vector& out, ll high) { out.resize(high + 1); out[0] = out[1] = 1; ll sqh = (ll)sqrt(high); for (ll i = 2; i <= sqh; i++) { if (out[i] == 0) { for (ll j = i*i; j <= high; j += i) { // i*i out[j] = 1; } } } } vector isc,pl,memo; int count(int x) { if (memo[x]) return memo[x]; for (int p:pl){ if (x%p==0) return memo[x]=count(x/p)+1; if (x==p) break; } return memo[x]=1; } { ll N,K;rd(N,K); gen_primelist(isc,N+1); pl.reserve((ll)sqrt(N)); REP(i,N+1) if(!isc[i]) pl.push_back(i); memo.resize(N+1); ll cnt=0; REP(i,N-1) cnt+=count(N-i)>=K; wt(cnt); }