This set of homotopy classes is in bijective correspondence with $\pi_3(M)$. More generally, let $[B^k,X;f]$ be the set of homotopy classes of maps $B^k\to X$ that restrict to a given $f:S^{k-1}\to X$, where homotopies are also through such maps. The thing to prove is that a homotopy $F:S^{k-1}\times I\to X$ from $f$ to another map $g$ induces a bijection $[B^k,X;f]\approx[B^k,X;g]$. This is similar to the familiar basepoint-change isomorphism for homotopy groups. One defines maps $[B^k,X;f]\to[B^k,X;g]$ and $[B^k,X;g]\to[B^k,X;f]$ by putting $F$ or its inverse homotopy in a collar neighborhood of $S^{k-1}$ in $B^k$ and filling in the rest of $B^k$ with maps representing elements of $[B^k,X;f]$ or $[B^k,X;g]$, as appropriate. Then it is easy to check that these maps $[B^k,X;f]\to[B^k,X;g]$ and $[B^k,X;g]\to[B^k,X;f]$ are well-defined and are inverses of each other.
In particular, if $[B^k,X;f]$ is nonempty then $f$ extends over $B^k$ so it is homotopic to a constant map $g$, and then $[B^k,X;g]=\pi_k(X)$.