I have been trying to solve this problem.
When $$$K=3$$$, $$$C(N,M,K)$$$ can be easily calculated by the triple sum $$$\sum_{a=N}^{M}\sum_{b=a+1}^{M}\sum_{c=b+1}^{M}abc$$$
As $$$K$$$ becomes larger, finding closed form of the sum becomes difficult. I tried another approach. When $$$M-N$$$ and $$$K$$$ are fixed, $$$C(N,M,K)$$$ can be expressed as a polynomial of degree $$$K$$$ on the variable $$$N$$$.
For example, if $$$M-N=10$$$ and $$$K=3$$$, $$$C(N,N+10,3)=18150+11880N+2475N^2+165N^3$$$.