What is the time-complexity of histogram computation?
Presumably the time complexity of the function hist applied to data of length $N$ and to $B$ bins is $O(N+B)$ (the exact definition of $B$ depends on the implementation of hist; in your case, it seems to be the maximum of the input). In your case, each of the $n/s_1$ iterations of the loop is applied to data of length $s_1 m$, and so the total running time is
$$ \frac{n}{s_1} O(s_1m + B) = O(nm + \frac{n}{s_1} B). $$
The answer that your teacher expects is $O(nm)$.