Let $M$ be an $R$-module and $S$ be a subset of $M$. The annihilator of $S$ in $R$ is $\operatorname{Ann}_{R}(S) = \{ \lambda \in R; \forall x \in S \ \ \ \lambda x = 0 \}$. I need to show that $\operatorname{Ann}_{R}(S)$ is an ideal(two-sided) of $R$ if $S$ is a submodule of $M$.
Obviously, in any case, it is a left ideal of $R$, since $\forall r \in R \ \ \forall a \in \operatorname{Ann}_{R}(S) \ \ \forall x \in S \ \ \ (ra)x = r(ax) = r0 = 0$. However, I'm not sure how to prove that is is also right ideals of $R$ in case if $S$ is a submodule of $M$.