If you have already seen some basic differential equations you can use the following technique. Let $u(x)=\lvert g(x)\rvert,\ U(x)=\int_a^x\, u(y)\, dy$. The given inequality can be rewritten as $ \tag{1} U'(x) \le K U(x).$ We claim that (1) implies that $U \le 0$ on $[a, b]$. Indeed, multiplying both sides of (1) by $\exp(-KU(x))$ we get $e^{-KU(x)}U'(x)- Ke^{-KU(x)}U(x)\le 0 ,$ so $\frac{d}{dx}\left( e^{-KU(x)}U(x)\right)=e^{-KU(x)}U'(x)-e^{-KU(x)}KU(x)\le 0.$ This means that $\exp({-KU(x)})U(x)$ is nonincreasing on $[a, b]$. Since $\exp({-KU(a)})U(a)=0$, we have $\exp({-KU(x)})U(x)\le 0$ and so $U(x)\le 0$ on $[a,b]$, because exponential is non negative. This proves the claim.
But now we recall that $U(x)$, being the integral of a nonnegative function, is itself nonnegative. The only possibility is that $U\equiv 0$. The only continuous and nonnegative function with a vanishing integral is the null function, so $u\equiv 0$ which means $g\equiv 0$.
This is exactly the technique one uses to prove Gronwall's inequality, which is a useful tool in differential equations.