#P1001. 更多牛铃(b)

更多牛铃(b)

Problem description

Kevin Sun wants to move his collection of nn cowbells from Naperthrill to Exeter, where there is more grass than corn. Before moving, he must pack the cowbell into kk boxes of a fixed size. To ensure transportation safety, each box can only contain a maximum of two cowbells. Since Kevin wants to reduce his expenses, he wants to know the smallest box size that can be used to fit all the cowbells into the box.

Kevin is a meticulous collector of cow bells. He knows that the size of the iith (1in1 \le i \le n) cow bell is an integer sis_i. In fact, he has already sorted the cow bells by size, so for i>1i > 1, we have si1sis_{i-1} \le s_i. At the same time, as a packaging expert, Kevin can put one or two cowbells into a box, provided that their total size does not exceed the size of the box ss. Based on this information, help Kevin find the smallest box size ss such that he can fit all the cowbells into kk boxes.

Input format

The first line of input contains two integers nn and kk (1n2k1000001 \le n \le 2 \cdot k \le 100000) separated by a space, which represent the number of cow bells and the number of boxes, respectively.

The next line contains nn space-separated integers s1,s2,...,sns_1, s_2, ..., s_n (1s1s2...sn10000001 \le s_1 \le s_2 \le ... \le s_n \le 1000000) denotes the size of Kevin's cow bell. Ensure that the size of the cowbells given is in non-decreasing order.

Output format

Output an integer representing the minimum box size ss such that all the cowbells can be packed into kk boxes.

2 1 
2 5 
7 
4 3 
2 3 5 9 
9 
3 2 
3 5 7 
8 

Tips

In the first example, Kevin must pack two cowbells into the same box.

In the second example, Kevin can package the cowbell in the following ways: (2,3)({2,3}), (5{5}), and (9{9}).

In the third example, the optimal solution is to package the cow bell into (3,5{3,5}) and (7{7}).