Queue#3004

Queue

1 second
128 megabytes
Easy

At a railway station, there are ticket counters, but only a single queue leading to them. The service process works as follows:

Initially, when all counters are free, the first people from the queue take the counters. The remaining customers wait in line. As soon as a counter becomes available after serving a customer, the next person in the queue takes the vacant spot. This process continues until all customers have been served.

Determine the minimum time required to serve all customers.

Input

The first line contains two integers: the size of the queue and the number of ticket counters (1 \le n \le 10^5, 1 \le k \le 10^4).

The second line contains positive integers t_i (1 \le t_i \le 10^5) — the service time for the -th customer.

Output

Print one integer — the minimum time required to serve the entire queue.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading