Question
K Cheapest Items

You are given N item prices. Choose exactly K items with minimum possible total cost.

Use a heap to maintain the selected items.

Input

The first line contains KaTeX can only parse string typed expression and KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression prices.

Output

Print the minimum possible total cost.

Example
Example:
Input
5 3

8 2 7 4 5
Output
11

Online