Exponent of a direct product of groups Prove that if the group $G=\prod_{i=1}^nH_i$, where each $H_i$ is a finite group, then the exponent of $G$ which is

$\exp(G)=\min\{n \in \mathbb{N}:g^n=e, \forall g \in G\}$ is equal with $\operatorname{lcm}(\exp(H_1),\ldots,\exp(H_n))=M$

I proved that $\exp(G) \leqslant M$

Can someone help me with the other direction ?

Thank you in advance!
Since this problem is a little subtler than I (and others) assumed at first glance, let me provide a detailed answer as penance.

Suppose that $p$ is a prime and $p^a$ is the largest power of $p$ dividing $M$.  I claim there is an element of $G$ with (positive) exponent divisible by $p^a$.  From this it follows that $p^a$ divides the exponent of $G$.  Applying this to all primes $p$ dividing $M$, we see that $M$ must divide the exponent of $G$; in particular, the exponent of $G$ is at least $M$.

Since $p^a$ divides $M$ and $M$ is the lcm of some numbers, $p^a$ divides one of these numbers, say the exponent of $H_i$.  Then there is some element $h \in H_i$ whose exponent is divisible by $p^a$.  It follows that $(1, \ldots, 1, h, 1, \ldots, 1) \in G$ has exponent divisible by $p^a$, so $G$ itself has exponent divisible by $p^a$.
You show the other direction by identifying an element of the product which has order M.  Hint: Find a tuple that maximizes each coordinate.