Let $(G,\cdot)$ be a finite abelian group and $m\in\Bbb{N}$. Prove that $S=\{g\in G\mid(o(g),m)=1\}\le G$. I am aware that I need to show that given any $g_1,g_2$ in $S$ if $(o(g_1g_2^{-1}),m)=1$ then $S$ will be a subgroup of $G$.
Now let $o(g_1)=r,o(g_2)=s,o(g_1g_2^{-1})=t$. Since $G$ is abelian we have 
$$\begin{align}
(g_1g_2^{-1})^{rs}&=g_1^{rs}(g_2^{-1})^{rs}\\
&=(g_1^r)^s((g_2^s)^{-1})^r\\
&=e^s(e^{-1})^r\\
&=e^se^r.
\end{align}$$ 
This implies that $t\mid rs$. Now we must show that $(t,m)=1$. I could not find a way to show this.
Any help here will be appreciated. Thanks in advance.
 A: If $g,h\in S$, if $a=o(g)$ and $b=o(h)$, then $o(h^{-1})=b$ and (since $G$ is abelian)$$o(gh^{-1})\mid o(g)o(h^{-1})=ab.$$Since both $a$ and $b$ are coprime with $m$, then so is $ab$ and therefore then so is $o(gh^{-1})$. In fact, if $o(gh^{-1})$ and $m$ are not coprime, then there is a prime number $p$ such that $p\mid o(gh^{-1})$ and $p\mid m$. But$$p\mid o(gh^{-1})\implies p\mid ab\implies p\mid a\text{ or }p\mid b.$$But this is impossible, since $(a,m)=(b,m)=1$.
A: More generally let $M$ be a set of naturals closed under multiplication and divisors, and let $S$ be the elements of $G$ whose order lies in $M$.  If $\,g,h\in S$ then $\,g^j = 1 = h^k\,$ for $\,j,k\in M$ so $\,jk\in M\,$ and $\,(gh)^{jk} = (g^j)^k (h^k)^j = 1\,$ so $\,o(gh)\mid jk\,$ so $\,gh\in S,\,$ and $\,(g^{-1})^j = (g^j)^{-1} = 1\,$ so $\,g^{-1}\in S$
Remark $ $ OP is special case $\,M=$ all naturals coprime to $m,\,$ which is closed under multiplication and divisors by Euclid [said equivalently: units (= invertibles) $\!\bmod m\,$ enjoy such closure].
