Step 1: Use the diagonal (Sarrus) rule for a $3\times3$ determinant.
For $M=\begin{bmatrix}2 & 1 & 1\\ 1 & 3 & 0\\ -1 & a & b\end{bmatrix}$, Sarrus' rule gives
\[ \det(M) = 2(3)(b) + 1(0)(-1) + 1(1)(a) - 1(3)(-1) - 2(0)(a) - 1(1)(b) \]
Step 2: Simplify term by term.
\[ \det(M) = 6b + 0 + a + 3 - 0 - b \]
\[ \det(M) = 5b + a + 3 \]
This matches the cofactor result, as it must.
Step 3: Test each candidate pair directly.
Plug each option's $(a,b)$ into $5b+a+3$ and check whether it survives as nonzero.
Option A: $5(-0.5) + (-0.5) + 3 = 0$, killed.
Option B: $5(0.5) + 0.5 + 3 = 6$, survives.
Option C: $5(0) + (-3) + 3 = 0$, killed.
Option D: $5(-3) + 0.5 + 3 = -11.5$, survives.
Step 4: Read off the answer.
Only options B and D keep the matrix nonsingular.
\[ \boxed{a=\tfrac12, b=\tfrac12 \text{ and } a=\tfrac12, b=-3} \]