The problem was solved, I mistyped something!

Sorry! i don’t know how to delete this post.

In definite integrals, the integration variable is always dummy. Mathematica has chosen K[1] in the hope that you had not used that variable for other purposes. The result seems correct:

sol = DSolveValue[Demand[t] == r[t], p, t];
Simplify[(Demand[t] == r[t]) /. p -> sol]

Sorry, problem solved!

Instead of S, you may try to express your problem in terms of the integral, as new unknown dependent variable. I have not really tried.