exact sequence of modules

Hi once again! I have two questions:

a) Let $\displaystyle R$ a PID and $\displaystyle M$ a finitely generated $\displaystyle R$-module. Show that the $\displaystyle R$-module $\displaystyle Hom_R(M,R)$ is free and has finite rank.

b) We have an exact sequence $\displaystyle 0 \longrightarrow R^m \longrightarrow R^n \longrightarrow M \longrightarrow 0$ of modules over a PID $\displaystyle R$. Show that $\displaystyle M/T(M)$ is a free $\displaystyle R$-module of rank n-m ($\displaystyle T(M)$ denoting the submodule of torsionelements).

To solve a) i tried to create an exact sequence involving Hom(M,R) but i got stuck. And for b) i do not have any ideas. Can anyone please help me?