You can just define g to be $0$ on the range $[M,T]$ so that the integral is equal to the integral over the range $[0,T]$ and then you can apply the method you mentioned first.
You can just define g to be $0$ on the range $[M,T]$ so that the integral is equal to the integral over the range $[0,T]$ and then you can apply the method you mentioned first.