  We specialize the Eichler-Selberg trace formula to obtain trace formulas for
the prime-to-level Hecke action on cusp forms for certain congruence groups of
arbitrary level. As a consequence, we determine the asymptotic in the prime p
of the number of (weighted) SL(2,Z)-conjugation orbits of 2 by 2 matrices of
determinant p whose reductions modulo N lie in a given conjugacy class in
GL(2,Z/NZ). This generalizes an 1885 result of Hurwitz.
