The problem is like
$max_{\mathbf{x} } \:u(x_1, x_2, ..., x_L) = - \sum_{i =1}^{L} \mid x_i - a_i\mid$,
$ s.t. \sum_i^L x_i \leq C$,
for each $i$, $a_i > 0$ is a scalar;
$C$ is a constant that is strictly greater than $0$;
$\mathbf{x} = (x_1, x_2, ..., x_L)\in {\mathbf R}^{L}_{+}$. Characterize the optimal $\mathbf{x}$ as a function of $C$ or $a_i$.
Hint: to solve the problem we should discuss the cases when $C \le \sum_i a_i $ and $C \ge \sum_i a_i$.
Thank you!