Polynomial Computation of the probability of a number of independent events
You can use dynamic programming. For parameters $m,\ell$, define
$$ q_{m,\ell} = \sum_{I \in \cal I_{m,\ell}} \prod_{i \in I} p_i \prod_{i \in [m] \setminus I} (1-p_i). $$
This satisfies the recurrence
$$
q_{m,\ell} = p_m q_{m-1,\ell-1} + (1-p_m)q_{m-1,\ell}
$$
with initial values $q_{0,0} = 1$ and $q_{m,\ell} = 0$ for $\ell &lt; 0$ and $\ell &gt; m$. This gives an $O(n^2)$ time algorithm.

The same idea can be expressed using generating functions:
$$
\prod_{i=1}^n (1-p_i + p_i x) = \sum_{k=0}^n \Pr(N_k) x^k.
$$