#C3840. Find Missing Score

    ID: 47312 Type: Default 1000ms 256MiB

Find Missing Score

Find Missing Score

You are given several test cases. In each test case, you are provided with the total number of participants n and the expected average score k. The total score for the test is computed as \( n \times k \). However, the scores of only \( n-1 \) participants are known. Your task is to determine the missing score such that the sum of all \( n \) scores is exactly \( n \times k \).

Formally, if the given scores are \( s_1, s_2, \dots, s_{n-1} \), then the missing score \( s_m \) is computed as:

[ s_m = n \times k - \sum_{i=1}^{n-1} s_i ]

It is guaranteed that the missing score is an integer.

inputFormat

The input is given via standard input (stdin) and has the following format:

q
n₁ k₁
s₁ s₂ ... sₙ₁₋₁
n₂ k₂
s₁ s₂ ... sₙ₂₋₁
...

Here, q is the number of test cases. For each test case, the first line contains two integers n (the total number of participants) and k (the expected average score). The following line contains n-1 integers representing the scores of n-1 participants.

outputFormat

For each test case, output a single line containing the missing score. The output is written to standard output (stdout).

## sample
1
4 5
5 8 4
3

</p>