You know that the minimal polynomial is a factor of $(t-1)^2(t-3)^4$ by Cayley-Hamilton, so you just need to determine which factors of $(t-1)^2(t-3)^4$ are polynomials that vanish when you plug in your matrix $M$, ie, you need to find which factors of $p(t)$ satisfy $p(M) = 0$.
Here the factors are of the form $(t-1)^i(t-3)^j$ with $i \le 2, j \le 4$.
For instance, you would see that $(t-1)^2(t-3)^4$ is forced to be the minimal polynomial were $(M-1)(M-3)^4$ and $(M-1)^2(M-3)^3$ were both found to be nonzero. But if $(M-1)(M-3)^4$ were zero, then the next step would be to check $(M-3)^4$ and $(M-1)(M-3)^3$, and you would proceed similarly until finished.
Alternatively, if you computed the Jordan normal form of your matrix, you would be done. Here the minimal polynomial would be $(t-1)^i(t-3)^j$ with the exponents $i,j$ to be the sizes of the largest Jordan blocks corresponding to eigenvalues $1,3$, respectively.