I'm reading this article and I was stuck in this part:

I didn't understand his trick computing the orders at $P$.
Remark: He defines $D=\inf\{div(\omega_{g-1}),div(\omega_g)\}$, i.e., $D=(l_{g-1}-1)P+E$, where $E$ is an effective divisor.
Thanks in advance!