#C8539. Maximize Book Stock
Maximize Book Stock
Maximize Book Stock
You are given \( N \) book categories and a list \( A = [a_1, a_2, \dots, a_N] \) representing the initial number of books in each category. You are also given an integer \( M \) representing the total number of operations available. In each operation, you may add one book to any category. Your task is to maximize the number of books in the category that ends up with the highest stock. Note that there is no benefit to removing books, so the optimal strategy is to add all \( M \) operations to the category that already has the highest number of books.
Formally, if \( a_{max} = \max\{a_1,a_2,\dots,a_N\} \), then the maximum stock achievable is \( a_{max} + M \).
inputFormat
The input is given via standard input. The first line contains a single integer T representing the number of test cases. Each test case is described as follows:
- The first line of each test case contains two space-separated integers \( N \) and \( M \), where \( N \) is the number of book categories and \( M \) is the total number of operations.
- The second line contains \( N \) space-separated integers \( a_1, a_2, \dots, a_N \) indicating the initial number of books in each category.
outputFormat
For each test case, output a single integer on a new line representing the maximum number of books that can be in the most stocked category after performing all \( M \) operations.
## sample1
3 4
5 7 10
14
</p>