  We study composition operators on the Hardy space $\mathcal{H}^2$ of
Dirichlet series with square summable coefficients. Our main result is a
necessary condition, in terms of a Nevanlinna-type counting function, for a
certain class of composition operators to be compact on $\mathcal{H}^2$. To do
that we extend our notions to a Hardy space $\mathcal{H}_{\Lambda}^2$ of
generalized Dirichlet series, induced in a natural way by a sequence of
Beurling's primes.
