Let $G$ be the ideal class group, and let $H$ be the subgroup generated by the prime ideals of norm at most $3\log^2(d)$. Assume that $H$ is a proper subgroup of $G$. Then there is a nontrivial character of $G$ that is trivial on $H$. This character is trivial on the prime ideals of norm at most $3\log^2(d)$, contradicting the first part of the theorem (with $\mathfrak{f}=\mathfrak{o}$). Hence $H=G$, and we are done.