Find non-identical matrices such that one cannot be converted into another by rearranging rows and then columns (Counting problem) [duplicate]

Given $$N \times M$$ binary matrices (matrix containing only $$0$$'s and $$1$$'s), two matrices are called identical if one can be converted into the other by first permuting the $$N$$ rows and then permuting the $$M$$ columns of the resulting matrix. Find the number of non-identical matrices.

I'm not really sure of how to begin this problem either. It's some recursion (or composition of more than one recursion) and I can't figure that out. May I get some valid hints?