Indecomposable $D$-module $M$, Jacobson's Basic Algebra I.

I can't do the left direction of this problem (this is the exercise 3 in the section 3.9)

Let $M$ be a finitely generated $D$-module over a p.i.d. Show that $$M\ \text{is indecomposable}\Longleftrightarrow\ M=Dz,\ \text{where \mathrm{ann}(z)=0 or \mathrm{ann}(z)=(p^n) with n\in \mathbb{N} and p prime.}$$

Well, the cases $\mathrm{ann}(z)=0$ and $\mathrm{ann}(z)=(p)$ are done for the left direction. I thought that If I could do the case $\mathrm{ann}(z)=(p^2)$, then I could finish the problem. In this case, I assumed that exists $N_1,N_2$ proper submodules, diferents from $\{0\}$, such that $$M=N_1\oplus N_2$$ Let's say that $i\in \{1,2\}$ and the annihilator of $N_i$ is $(d_i)$. Clearly $(p^2)\subset (d_i)$, so $d_i|p^2$, then I proved that this implies the following cases:

1.- $(d_1)=(p^2)$ and $(d_2)=(p)$ or

2.- $(d_i)=(p^2)$ with $i=1,2$.

and then I don't know how to go on.

It's worth to say that, in the same exercise, one show that $M$ is irreducible (assuming $M$ a torsion module over a p.i.d. such that $M\neq \{0\}$) if and only if $M=Dz$ and $\mathrm{ann}(z)=(p)$, with $p$ prime.

Any hints are welcome. Thanks in advance.

Since $M$ is generated by a single element $z$, we have the isomorphism $M \cong D/\mbox{ann}(z) = D / p^n D$. (The isomorphism sends $dz \mapsto d$.)
In the case $D = \mathbb{Z}$, we see that the subgroups of the cyclic group $\mathbb{Z}/p^n \mathbb{Z}$ form a single chain, and therefore any 2 nontrivial subgroups have nontrivial intersection. Therefore the group cannot be decomposed into a nontrivial direct sum. Now generalize this argument to an arbitrary p.i.d. (with $D$-submodules instead of just subgroups).