On the deviation and the type of a Cohen-Macaulay ring