Python, 118128 bytes (or 77 bytesnumpy)
Say A is your array
(lambda A,N: (lambda A,MS:[[A[U][I-U] for U in range(max(I-M+1,0),min(NS[1]-1,I)+1)] for I in range(M+N-1)])(A,len(A),len(A and A[0]))
If I am allowed to have A, N, and M as separate variables...
[[A[U][I-U] for U in range(max(I-M+1S[0]+1,0),min(N-1,I)+1-1)] for I in range(M+NS[1]+S[0]-1)])(A,A.shape))"