题目描述
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ items in his shop (numbered $1$ through $N$); for each valid $i$, the price of the $i$-th item is $P_{i}$. Since Chef has very loyal customers, all $N$ items are guaranteed to be sold regardless of their price.
However, the government introduced a price ceiling $K$, which means that for each item $i$ such that $P_{i} > K$, its price should be reduced from $P_{i}$ to $K$.
Chef's revenue is the sum of prices of all the items he sells. Find the amount of revenue which Chef loses because of this price ceiling.
------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains two space-separated integers $N$ and $K$.
The second line contains $N$ space-separated integers $P_{1}, P_{2}, \ldots, P_{N}$.
------ Output ------
For each test case, print a single line containing one integer ― the amount of lost revenue.
------ Constraints ------
$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10,000$
$1 ≤ P_{i} ≤ 1,000$ for each valid $i$
$1 ≤ K ≤ 1,000$
------ Subtasks ------
Subtask #1 (100 points): original constraints
----- Sample Input 1 ------
3
5 4
10 2 3 4 5
7 15
1 2 3 4 5 6 7
5 5
10 9 8 7 6
----- Sample Output 1 ------
7
0
15
----- explanation 1 ------
Test Case 1: The initial revenue is $10 + 2 + 3 + 4 + 5 = 24$. Because of the price ceiling, $P_{1}$ decreases from $10$ to $4$ and $P_{5}$ decreases from $5$ to $4$. The revenue afterwards is $4 + 2 + 3 + 4 + 4 = 17$ and the lost revenue is $24 - 17 = 7$.
Test Case 2: The initial revenue is $1 + 2 + 3 + 4 + 5 + 6 + 7 = 28$. For each valid $i$, $P_{i} ≤ 15$, so there are no changes, the revenue after introduction of the price ceiling is the same and there is zero lost revenue.
Test Case 3: The initial revenue is $10 + 9 + 8 + 7 + 6 = 40$. Since $P_{i} > 5$ for each valid $i$, the prices of all items decrease to $5$. The revenue afterwards is $5 \cdot 5 = 25$ and the lost revenue is $40 - 25 = 15$.
输入格式
见题面
输出格式
见题面