He is just doing a partial fraction decomposition writing K/P(K-P) = A/P + B/(K-P). The resulting eqn K = A(K-P) + BP holds for all P, so he conveniently chose P=0 so as to eliminate the second term on the RHS and thereby obtain a value for A. Similarly, choosing P=K allows cancellation of the first term on the RHS and so a value for B can then be found easily.

He is just doing a partial fraction decomposition writing K/P(K-P) = A/P + B/(K-P). The resulting eqn K = A(K-P) + BP holds for all P, so he conveniently chose P=0 so as to eliminate the second term on the RHS and thereby obtain a value for A. Similarly, choosing P=K allows cancellation of the first term on the RHS and so a value for B can then be found easily.