You basically ask about the sum $$ \sum_{n \le x} \alpha(n)$$ where $\alpha$ is a completely multiplicative function with $\alpha(p) = \mathbf{1}_{p \notin \mathcal{P}}$.
This is addressed by Wirsing in his famous paper Das asymptotische Verhalten von Summen über multiplikative Funktionen
(Math. Ann. 143 (1961), 75–102). The only requirement on $E$ is $E(x)=o(\pi(x))$, and it gives the asymptotic result
$$\sum_{n \le x} \alpha(n) \sim\frac{ e^{-\gamma \kappa}}{\Gamma(\kappa)} \frac{x}{\log x} \prod_{p \le x,\, p \notin \mathcal{P}}(1-p^{-1}),$$
where $\gamma$ is the Euler-Mascheroni constant (appearing also in Mertens' theorem).