Suppose I have a $N\times N$ integer matrix $A$ that has the Smith normal form $diag[a_1, a_2,...a_N]$, and we have a matrix $B$ such that $AB=I_N$. Is there an easy way to find the Smith normal form of $B$? Or can we say anything about the invariant factors of $B$?
Thank you in advance.
Edit: adding essential information that $A$ is an integer matrix