DMOPC '16 Contest 3 P5 - Shoe Shopping II
View as PDFAfter returning from the nautical lessons, Captain Akeno asked her good friend to go and get her some more shoes while she is at school, from the same shop. When arrived at the store, he observed some deals. The deals are as follows:
- If you group two pairs of shoes, you get the cheaper one at a 50% discount.
 - If you group three pairs of shoes, you get the cheapest one for free.
 
 is rather lazy, and doesn't really care about the best price, so he asked the cashier to group the pairs as she sees fit. The cashier can only group adjacent pairs in the order  placed them on the conveyor. Additionally, the cashier is instructed with a special number, , which represents that she needs to get the 
-th smallest unique obtainable price from grouping the pairs. How much money is  going to pay?
Input Specification
The first line of input will contain two space-separated integers,  (
) and 
 (
).
The second line of input will contain  space-separated integers representing the prices of the pairs of shoes. It is guaranteed that the total sum of the numbers does not exceed 
.
Output Specification
On the first line, you must print the -th smallest unique obtainable price with one decimal. In case you can't find an answer, print 
-1.
Sample Input
5 3
100 27 15 25 400
Sample Output
541.0
Comments
I be Spendin' dat
 dollas on mah shoes homie. Idk about u but I roll big