Let $V=M_n(\mathbb C)$ and $A\subseteq B$ are subspaces of $V$. Let also $$ M=\{X\in V:\ \forall Y\in B,\ XY-YX\in A\}. $$ Suppose $X_0\in M$ enjoys the property that $\operatorname{tr}(ZX_0)=0$ for any $Z\in M$. Show that $X_0$ is nilpotent.
My attempt: I know that $$\operatorname{tr}(XY-YX)=0$$ but I cannot continue from there. Thank you for any help. The problem appears on a Chinese bulletin board. A soluton can be found in section 4.3 of James E. Humphreys, Introduction to Lie Algebras and Representation Theory, but I want to know if this problem can be solved by other methods. Thank you.