Counter Queue#243

Counter Queue

1 second
128 megabytes
Easy (≈1000)

In developed countries' railway stations, there are working counters, but they operate with a single queue. The service is conducted as follows: Initially, if all counters are empty, the first people in the queue approach the counters, while the others wait for their turn. Once someone is served, the respective counter becomes free, and the next person in the queue approaches this counter. This process continues until all customers are served.

Determine the total service time for all customers.

Input

The first line contains two integers: the length of the queue and the number of counters k~(1 \le n \le 10^5, 1 \le k \le 10^4). The second line contains natural numbers. The -th number indicates the service time required for the -th customer, denoted as t_i~(1 \le t_i \le 10^5).

Output

Provide a single integer — the time it takes to serve the given queue.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading