Given $m \times n$ matrix $\bf X$ and $m \times p$ matrix $\bf Y$, define the loss function in $n \times p$ matrix $\bf R$
$$ \operatorname{Loss} ({\bf R}) := \| \mathbf{X} \mathbf{R} - \mathbf{Y} \|_F^2 $$
where the square of the Frobenius norm of $n \times m$ matrix $\mathbf{A}$ is defined as
$$ \| \mathbf{A} \|_F^2 = \sum_{i=1}^n \sum_{j=1}^m a_{ij}^2 $$
I have to compute the gradient $\nabla_{{\bf R}} \operatorname{Loss}$. My source says:
$$ \nabla_{{\bf R}} \operatorname{Loss} ({\bf R}) = \dfrac2m \mathbf{X}^T (\mathbf{X} \mathbf{R} - \mathbf{Y} ) $$
but I am not sure how to obtain this result.