We have matrices $\mathbf{K} \in \mathbb{C}^{M \times M}$, $\mathbf{C} \in \mathbb{C}^{N \times M}$ for $N \leq M$ and a diagonal matrix $\mathbf{D} \in \mathbb{C}^{N \times N}$.
Let function $f = \text{tr}\{\mathbf{I}-2\mathbf{C}\mathbf{K}\mathbf{C}^{H}+\mathbf{C}\mathbf{K}\mathbf{C}^{H}\mathbf{C}\mathbf{K}\mathbf{C}^{H} -\mathbf{D}\mathbf{C}\mathbf{C}^H\}$.
Here, $(\cdot)^H$ is hermitian matrix operator.
Then, what is $\frac{\partial f}{\partial \mathbf{C}}$?
For convenience, define the variable $$A=KC^H$$ Then write the function in terms of this new variable and the Frobenius (:) Inner Product and find its differential $$\eqalign{ f &= I:I-2I:CA+I:CACA-I:DCC^H\cr &= I:I-2A^T:C+A^TC^T:CA-DC^*:C\cr\cr df &= 0-2A^T:dC+A^TdC^T:CA+A^TC^T:dCA-DC^*:dC\cr &= -2A^T:dC+A^TC^TA^T:dC+A^TC^TA^T:dC-DC^*:dC\cr &= (2A^TC^TA^T-DC^*-2A^T):dC\cr }$$ where $C^H=(C^T)^*$.
Since $df=\big(\frac{\partial f}{\partial C}:dC\big),\,$ the gradient must be $$\eqalign{ \frac{\partial f}{\partial C} &= 2A^TC^TA^T-DC^*-2A^T \cr &= 2C^*K^TC^TC^*K^T-DC^*-2C^*K^T \cr\cr }$$ Keep in mind that $\{C^*, C^H, A\}$ are independent of $C$ for purposes of differentiation.