SPEED TIME DIST.
M to K 8+c 12/(8+c) 12
K to M 10-c 12/(10-c) 12
Solve the equation for c.
If you have more examples just like this, then using G for the downstream boat and L for the upstream boat, , D for distance each way, c for unknown speed of the river, then:
SPEED TIME DIST.
MtoK L+c D/(L+c) D
KtoM G-c D/(G-c) D
-