

Water a plant if he has sufficient water in the container, otherwise refill it.
You can only refill at the water tank which is placed one step before the first flower.
Let arr = {3, 5, 1, 2}, k = 6
Now in this example, he will first move to the first flower and water it. Now his container contains only 3 liters of water, hence he will refill the container, so he goes 1 step back and refills, comes to the 2nd flower, after watering the second flower, he still has 1 liter of water and 1 flower left. So he will water that flower and return to refill. Now he will come to the last flower and water it.
Hence the total steps taken are: 1 + 1 + 2 + 1 + 3 + 4 = 12.
The first line contains a single integer ‘T’ denoting the number of test cases to be run. Then the test cases follow.
The first line of each test case contains two integers ‘n’ and ‘k’, denoting the number of flowers and capacity of the container, respectively.
The second line of the test case contains an array “arr” of size ‘n’, where “arr[i]” denotes the amount of water needed to the ith flower.
For each test case, print a single integer “answer” denoting the total steps taken by Takahashi.
Output for each test case will be printed in a separate line.
You are not required to print anything; it has already been taken care of. Just implement the function and return the answer.
1 <= T <= 100
1 <= N <= 10^4
1 <= k <= 10^5
1 <= arr[i] <= k
Time limit: 1 sec
In this approach, we will check for every flower if we can water it or not, if we can water it we will water that flower and check for the next flower, else we will go and refill our container.
The steps are as follows: