Proving NP-completeness for a not so cheesy problem
The problem is in $NP$ since a certificate is the path itself, which has length at most $2B-1 + 2 = 2B+1$.
Given an instance $\langle S, k\rangle$ of subset sum where $S = \{x_1, \dots, x_n\}$ is a set of integers and $k$ is the target value, you can create an instance of your problem by choosing: $B=n+2$, $M = \mbox{diag}(0, x_1, x_2, \dots, x_n, 0)$, and $A = k$.
Clearly any path in $M$ that collects $A$ pieces of cheese implies the existence of a subset $S' \subseteq S$ such that $\sum_{x_i} x_i = A = k$.
On the converse notice that, given any $S' \subseteq S$ satisfying $\sum_{x_i} x_i = k$, it is possible to find a path $P$ in $M$ with the sought constraints (actually, backtracking is not even required) that traverses $M[i+1, i+1]$ if and only if $x_i \in S'$. This shows that pieces of cheese collected by $P$ are exactly $k=A$.
Also notice that your problem can be solved by pseudopolynomial-time dynamic programming algorithm having complexity $O(A \cdot B^2)$.