II. (40 points) Let $a_{1}, a_{2}, \cdots, a_{k}\left(k \in \mathbf{Z}_{+}\right)$ all be integers greater than 1, and satisfy
$$
\left(a_{1}!\right)\left(a_{2}!\right) \cdots\left(a_{k}!\right) \mid 2017!\text {. }
$$

When $k$ varies, find the maximum value of $\sum_{i=1}^{k} a_{i}$.
$$
\begin{array}{l}
\text { Let } a_{i} \text { have } k \text { twos and } l \text { threes, and the sum of the remaining numbers be } S. \text { Let } v_{p}(n) \text { be the power of } p \text { in } n!. \\
\text { For any } x \in \mathbf{Z}_{+}(x \geqslant 4), \text { we have } \\
v_{2}(x)=\sum_{k=1}^{\infty}\left[\frac{x}{2^{k}}\right]>\left[\frac{x}{2}\right]+1>\frac{x}{2}, \\
\text { where } [x] \text { denotes the greatest integer not exceeding the real number } x. \\
\text { Then } k+l+\frac{S}{2} \leqslant v_{2}\left(\left(a_{1}!\right)\left(a_{2}!\right) \cdots\left(a_{n}!\right)\right) \\
\leqslant v_{2}(2017!)=2010, \\
l \leqslant v_{3}\left(\left(a_{1}!\right)\left(a_{2}!\right) \cdots\left(a_{n}!\right)\right) \\
\leqslant v_{3}(2017!)=1004. \\
2 \times(1)+(2) \text { gives } \\
\sum_{i=1}^{n} a_{i}=2 k+3 l+S \leqslant 5024. \\
\text { When } a_{1}=a_{2}=\cdots=a_{1006}=2, a_{1007}=a_{1008}= \\
\cdots=a_{2010}=3, \sum_{i=1}^{k} a_{i} \text { achieves its maximum value of } 5024.
\end{array}
$$