Solution
= Solution
The <divisor> $D=\sum_iH_i$ has degree $md$. The hypothesis gives $\deg(K-D)=2g-2-md<0$. A <divisor> of negative degree has no nonzero section: if $h\in L(K-D)\setminus\{0\}$, then $(h)+K-D$ would be effective, but its degree would be negative because the <divisor> of a <meromorphic function> has degree zero. Thus $\ell(K-D)=0$. The <Riemann-Roch theorem> now gives
$$
\boxed{\ell(D)=md+1-g=md+\frac{d(3-d)}2.}
$$