Reductions among two problems related to walks of length $k$
Since $k$ is a constant you can solve $B$ in polynomial-time by exploring all $O(n^{k-1})$ paths of length $k$ starting from $s$ and ending in $t$, as you point out.
At this point the reduction is trivial:
If the answer to an instance $\langle G, s, t\rangle$ of $B$ is &quot;yes&quot; then the corresponding instance of $A$ is $G$.
If the answer to the instance  $\langle G, s, t \rangle$  is &quot;no&quot;, then the instance of $A$ is the empty graph.