Statistical distance in distributions
If $m$ divides $N$, then you get the uniform distribution over $[m].$

Let $k=N-\lfloor N/m \rfloor m.$ Note that $k\geq 0,$ with $k&gt;0,$ if $m$ does not divide $N.$ When you reduce $Z$ modulo $m$, due to wraparound, the smallest $k$ values $0,1,\ldots,k-1$ are "hit" an extra time, as $Z$ varies from $0$ to $N-1.$
Thus the probability distribution of $W=Z \pmod m$ is:

$P[W=u]=\frac{1}{N}(\lfloor N/m \rfloor +1)\quad w\leq k-1,$

and

$P[W=u]=\frac{1}{N}(\lfloor N/m \rfloor)\quad k\leq w\leq N-1.$

Now sum these values absolute difference with $1/(N/m)$ which is the value of the uniform distribution at each point.

For part 2, group via row or column for each marginal distribution and apply a similar technique, to get the individual distances. Now look at the joint taking care to scale correctly when you sum over the whole array for the statistical distance of the joint from the uniform.