$\newcommand{\Spec}{\operatorname{Spec}}$ $\newcommand{\mSpec}{\operatorname{Max}}$
This is a homework from my algebra course. I am in a situation where I think I have found a solution, though somehow there's a condition in the question that I don't need.
Important: I don't want help on the problem itself, I just want to know what's wrong with my proof!
Exercise: Let $R$ be an integral domain with quotient field $K$. Let $M \subset K$ be an $R$-submodule of $K$. Then for each prime ideal $\mathfrak{p} \subset R$ we can regard $M_\mathfrak{p} \subset K$.
Show that $M = \bigcap_{\mathfrak{p} \in \Spec(R)} M_\mathfrak{p} = \bigcap_{\mathfrak{m} \in \mSpec(R)} M_\mathfrak{m}$
as $R$-submodules of $K$.
My proof: the inclusions from left to right are obvious (since $R$ is an integral domain and $M$ is torsionfree the inclusion $M \rightarrow M_\mathfrak{a}$, $a \mapsto \frac{a}{1}$ is injective, so $M$ can be seen as an $R$-submodule of any of the $M_\mathfrak{p}$. The inclusion $\bigcap_{\mathfrak{p} \in \Spec(R)} M_\mathfrak{p} \subset \bigcap_{\mathfrak{m} \in \mSpec(R)} M_\mathfrak{m}$ is always trivial.
Now for the inclusion $\bigcap_{\mathfrak{m} \in \mSpec(R)} M_\mathfrak{m} \subset M$:
Let $\frac{1}{s} \cdot m \in \bigcap_{\mathfrak{m} \in \mSpec(R)} M_\mathfrak{m} \Rightarrow \forall \mathfrak{m} \in \mSpec(R): \frac{1}{s} \cdot m \in M_\mathfrak{m} \Rightarrow \forall \mathfrak{m} \in \max(R): s \notin \mathfrak{m}$.
Therefore $s$ is a unit in $R$ and $\frac{1}{s} \cdot m = s^{-1} \cdot m \in M$.
However, I don't see where my proof uses the fact that $M$ is a submodule of $K$ (torsionfree and integral domain would be enough). This confuses me a bit, so I am afraid to have made a mistake. It would be nice if someone could check this solution and tell me what I have done wrong, because right now I seem to be blind. Thanks a lot.
Edit: I've just realized that all the $M_\mathfrak{p}$ must be submodules of some module $P$ for the $\bigcap$ to be defined. But is this really all the problem?