You're playing a new game. There are $n$ monsters in this game, each with a specific strength. The strength of the $i$-th monster is $a_i$, which means that it costs $a_i$ energy coins to kill that monster ``by hand''. In the game, there is also a nuke button, that can be pressed at multiple moments during the game, as many times as you want. Pressing the nuke button costs $K$ energy coins; consequently, half of the monsters are killed instantly at random with no additional costs. Namely, if there are currently $m$ monsters alive, after pressing the nuke button, $\lfloor\frac{m}{2}\rfloor$ random monsters will be killed.
Given the strength of all the monsters and the cost of pressing the nuke button, find the minimum total cost (in energy coins) needed to kill all the monsters, in the worst case.