#C2190. Earliest Study Start Time
Earliest Study Start Time
Earliest Study Start Time
You are given several test cases. In each test case, you are provided with two integers K (the number of chapters) and H (the total available hours before an exam), followed by a list of K integers representing the time required (in hours) to study each chapter.
Your task is to compute the earliest hour that Avery should start studying such that all chapters can be finished within the available H hours. Mathematically, if \(T_i\) is the time for each chapter, then the starting hour \(S\) is calculated as:
\(S = H - \sum_{i=1}^{K} T_i\)
Print the result for each test case on a new line.
inputFormat
The first line contains a single integer T, the number of test cases.
For each test case:
- The first line contains two space-separated integers: K and H.
- The second line contains K space-separated integers, representing the time required for each chapter.
The input is given via standard input (stdin).
outputFormat
For each test case, print a single integer on a new line, representing the earliest, or the spare, hour to start studying.
The output should be written to standard output (stdout).
## sample2
3 10
2 3 4
5 20
1 2 3 4 2
1
8
</p>