#K82337. Minimum Total Strength Reduction

    ID: 35953 Type: Default 1000ms 256MiB

Minimum Total Strength Reduction

Minimum Total Strength Reduction

You are given a threshold value \(X\) and a number of test cases. Each test case consists of a list of foxes' strengths.

Your task is to calculate the minimum total strength that must be reduced so that the strength of every fox does not exceed \(X\). In other words, for each test case, compute the sum \[ \sum_{i=1}^{N} \max(0, s_i - X)\] where \(s_i\) represents the strength of the \(i\)-th fox.

Print the result for each test case on a new line.

inputFormat

The first line contains two integers \(T\) and \(X\), where \(T\) is the number of test cases and \(X\) is the maximum allowed strength.

Each test case is described as follows:

  • The first line contains an integer \(N\), the number of foxes.
  • The second line contains \(N\) integers representing the strengths of the foxes.

All input is provided via stdin.

outputFormat

For each test case, output a single integer representing the total strength reduction required, each on its own line.

All output should be written to stdout.

## sample
2 10
3
4 7 5
4
1 3 2 6
0

0

</p>