You are given N people standing in a queue to buy movie tickets. The i-th person in the line (1-indexed) initially requires T_i tickets.
The ticket-buying process works as follows:
It takes exactly 1 minute for a person to buy 1 ticket.
After a person buys a single ticket, if they still need more tickets, they must immediately move to the end of the line.
If a person no longer needs any tickets, they leave the line.
Your task is to calculate the total number of minutes that pass until the K-th person in the original line finishes buying all their required tickets.
Input
The first line contains two integers N and K (1 \le K \le N \le 10^5).
The second line contains N integers T_1, T_2, \dots, T_N (1 \le T_i \le 10^9), representing the number of tickets each person needs.
Output
Print a single integer representing the total time in minutes until the K-th person finishes buying their tickets.
Examples
| standard input | standard output |
|---|
| 3 2
2 3 2
| 7
|
| 4 1
5 1 1 1
| 8
|