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 $$(\star)\, \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})^{-1},$$ where $\gamma$ is the Euler-Mascheroni constant (appearing also in Mertens' theorem). If $E(x)$ is small enough (say, $x/(\log x)^{1+\varepsilon}$) the product may be simplified by partial summation, giving $$C(\mathcal{P})\frac{x}{(\log x)^{\kappa}}$$ for $$C(\mathcal{P}) =\frac{ 1}{\Gamma(\kappa)} \prod_{p \notin \mathcal{P}}(1-1/p)^{-1} \prod_{p}(1-1/p)^{1-\kappa}.$$
In Wirsing's sequel to his own paper, ``Das asymptotische Verhalten von Summen über multiplikative Funktionen. II'' (Acta Math. Acad. Sci. Hungar. 18 (1967), 411–467) he relaxes the condition on $\mathcal{P}$ even further, requiring less than positive relative density, while still retaining $(\star)$.