Doubt in Counting terms (Feb11)

I am having problem calculating g(n, k) from f(n, k).

Can anybody please give some kind of explanation for the problem.The editorial for the problem skips over this part.