I know that the Cohen-Macaulay type has this two definitions:

 - Let $(R,\mathfrak{m},k)$ be a Cohen-Macaulay (noetherian) local ring; $M$ a finite $R$-module of depth t. The number $r(M) = dim_k Ext_R^t(k,M)$ is called Cohen-Macaulay type of $M$.
 - Said $\beta_i(M)$ the Betti numbers in a minimal free resolution of $M$ ($M$ is an $R$-module as before) then the Cohen-Macaulay type of $M$ is the last non zero Betti number, is that $r(M) = \beta_s(M)$.

So I would ask how to prove the equivalence of this two definitions. There are some books in which I can find this proof?