Possible unique paths to reach cell (0,n-1) from cell (0,0) given vector of must visited rows and allowed movement directions
Subproblem 1: Find the number of possible paths from $[i,j]$ to $[k,\ell]$ for all $i,k \in \{0,\dotsc,m-1\}$ and $j,k \in \{0,\dotsc,n-1\}$. Store them in a table $A$ of size $m$ x $n$ x $m$ x $n$. In other words, an entry $A[i][j][k][\ell]$ stores the number of possible paths from $[i,j]$ to $[k,\ell]$. You can construct this table since this is similar to the second variant of your problem while considering the restrictions.
Subproblem 2: Find the number of possible paths from $[i,j]$ to $[k,\ell]$ that does not goes through the entries: $[k,0], \dotsc, [k,\ell-1]$, for all $i,k \in \{0,\dotsc,m-1\}$ and $j,k \in \{0,\dotsc,n-1\}$. Store them in a table $T$ of size $m$ x $n$ x $m$ x $n$. In other words, an entry $T[i][j][k][\ell]$ stores the number of possible paths from $[i,j]$ to $[k,\ell]$ that does not pass through the entries: $[k,0], \dotsc,[k,\ell-1]$. You can construct this table from the entries of the previous table $A$ but it will require some more work.
Main Problem: Suppose the row vector is $(r_{i_{1}},r_{i_{2}},\dotsc,r_{i_{p}})$. Here, I am assuming the $0$ based indexing. In other words, if $r_{i_{j}} = 4$, it means it is the fifth row. For sake of better understanding of the solution, let me add $r_{i_{0}} = 0$ at the beginning of this row vector. Now, the row vector is $(r_{i_{0}},r_{i_{1}},r_{i_{2}},\dotsc,r_{i_{p}})$.
Now, we define a table $R$ of size  $(p+1)$ x $n$ such that $R[t][j]$ denote the number of possible paths from $[r_{i_{t}},j]$ (for valid $r_{i_{t}}$ and $j$) to the $[0,n-1]$ that goes through the row vector $(r_{i_{t+1}},\dotsc,r_{i_{p}})$
Output: The algorithm should output $R[0][0]$ since it denote the number of possible paths from $[0,0]$ to the $[0,n-1]$ that goes through the row vector $(r_{i_{1}},\dotsc,r_{i_{p}})$
Induction Step:
$$R[t][j] = \sum_{\ell = 0}^{\ell = n-1} \Big( T[r_{i_{t}}][j][r_{i_{t+1}}][\ell] \Big)\cdot \Big(R[t+1][\ell] \Big) $$
Base Step: When $t$ becomes equal to $p$, we get $R[p][j]$, which denote the number of possible paths from $[r_{i_{p}},j]$ to $[0,n-1]$ that does not goes through any row vector.
$$R[p][j] = A[r_{i_{p}}][j][0][n-1] \quad \textrm{ for all valid $j \in \{0,\dotsc,n-1\}$}$$

Since you just asked for hints, this is more than sufficient.