The cosine power series can be expanded using
$\left(\sum_{\ell=0}^\infty \frac{(-1)^\ell}{(2\ell)!}a^{2\ell}\right)^m=\sum_{\lambda_1,\cdots,\lambda_m=0}^\infty \frac{(-1)^{\lambda_1+\cdots+\lambda_m}}{(2\lambda_1)!\cdots(2\lambda_m)!}a^{2\lambda_1+\cdots+2\lambda_m}$
$=\sum_{n=0}^\infty \left(\frac{(-1)^{n}}{(2n)!}\sum_{|\lambda|=n}\binom{2n}{2\lambda_1,\cdots,2\lambda_m}\right)a^{2n}.$
Note we sum over all nonnegative $\lambda_1,\cdots,\lambda_m$ that sum to $n$ within the inner sum, and rewrite the negative-one power using this, as well as both multiply and divide by $(2n)!$ so we can use a multinomial (because I feel like using that would make things look nice, I guess). Ultimately this boils down to collecting all terms that are in front of an $a^{2n}$ power into one sum. This may or may not be in a useful form for you, I don't know.
Note that we can evaluate the inner sum using the multinomial theorem and symmetry:
$\sum_{|\lambda|=n}\binom{2n}{2\lambda_1,\cdots,2\lambda_m}=\frac{1}{2^m}\sum_{x_i=\pm1} (x_1+\cdots+x_m)^{2n}$
Here the sum is over $x_i$'s being plus or minus one, independently. We can collect all terms with $v$ negative-ones and rewrite this as
$\frac{1}{2^m}\sum_{v=0}^m \binom{m}{v}(m-2v)^{2n}. $
Multiply this by $(-1)^n/(2n)!$ and you have the coefficient of $a^{2n}$ in $\cos^ma$. 8-)