  We study M5-branes compactified on $S^1$ from the D0-D4 Witten index in the
Coulomb phase. We first show that the prepotential of this index is S-dual, up
to a simple anomalous part. This is an extension of the well-known S-duality of
the 4d $\mathcal{N}=4$ theory to the 6d $(2,0)$ theory on finite $T^2$. Using
this anomalous S-duality, we find that the asymptotic free energy scales like
$N^3$ when various temperature-like parameters are large. This shows that the
number of 5d Kaluza-Klein fields for light D0-brane bound states is
proportional to $N^3$. We also compute some part of the asymptotic free energy
from 6d chiral anomalies, which precisely agrees with our D0-D4 calculus.
