#K45872. Minimum Remaining Book Height Sum
Minimum Remaining Book Height Sum
Minimum Remaining Book Height Sum
You are given n books with their respective heights, and an integer k which denotes the number of books to remove. Your task is to remove exactly k books such that the sum of the heights of the remaining books is obtained by removing the k smallest books. In other words, if the heights are sorted in non-decreasing order as \(h_1 \le h_2 \le \dots \le h_n\), then you are required to compute the sum:
[ S = \sum_{i=k+1}^{n} h_i ]
Output the computed sum.
inputFormat
The first line of input contains two space-separated integers: n (the number of books) and k (the number of books to remove).
The second line contains n space-separated integers representing the heights of the books.
outputFormat
Output a single integer representing the sum of the heights of the remaining books after removing the k smallest books.
## sample5 2
4 1 3 5 2
12
</p>