408842: GYM103348 D Witches Cauldron I

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Witches Cauldron Itime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Double double, toil and trouble... The Weird Sisters are heating ingredients for a new concoction to mix into a big mixing pot, but their cauldron for heating recently broke! They have a list of essences to throw into a cauldron to heat in order, but they only have time to heat the cauldron a certain number of times before they need to cast their spell. Each essence needs to be fully in the cauldron (i.e. cannot be split), and all essences are in liquid form.

The Weird Sisters need to purchase a cauldron big enough to finish the spell in time, but are still economical. Can you help them find the smallest size of cauldron that will help them finish in time?

Input

First line of input are two integers $$$1 \leq n \leq 5 \cdot 10^5$$$ and $$$1 \leq k \leq 10^6$$$, the number of essences that must be heated and the number of times they can heat respectively.

The next line contains $$$n$$$ integers, the volume of each essence $$$1 \leq a_i \leq 10^6$$$ in order that needs to be heated.

Output

One integer $$$v$$$, the volume of cauldron needed to finish heating in $$$k$$$ rounds.

ExamplesInput
3 1
3 1 2
Output
6
Input
4 2
3 1 2 2
Output
4

加入题单

算法标签: