Marbles (unable to implement)

i m unable to implement (n-1)C(k-1) for this large constraints , can u help me with this?

@Sagarjha07,
Try to use DP.