If the function $f(x) = \begin{cases} ax+1, & x \leq 3 \\ bx+3, & x > 3 \end{cases}$ is continuous at $x = 3$, then find the values of $a$ and $b$.