In a car race, there are N cars 1,2 … N where the ith car is moving with a speed of (N – i + 1). All the cars are moving in the same direction.
The current position of the cars is Xi. Determine the time at which the first overtake takes place.
Note: Overtake is defined as the place when a car crosses another car that is ahead of it.
- Each test contains multiple test cases.
- The first line contains the number of test cases T.
- The first line of each test case contains two space-separated integers N and M representing the number of cars and the length of the circular path.
- The second line of each test case contains N integers where the ith integer is Xi representing the position of the ith car on the track.
For each test case, print a single line containing one integer representing the time at which the first overtake takes place.
The first overtake takes place at time t = 1.