Alice lives in a country. In this country, there are only N cities located in a row, each city has a magic number such as the ith city contains ai number. She wants to visit the K cities of this country. Alice starts with a city where the magic number of that city is 1. Then if you are in city X, then the next city can be city Y, if ay=ax+1. Alice wants to choose the order of the cities she will visit so that the distance traveled was the maximum. The distance between neighboring cities is 1.
Input format
Output format
In a single line, print one integer denoting the maximum distance that Alice will have to cover.
Constraints
1≤T≤10
1≤K≤N≤105
1≤ai≤K
For each j, there is at least a city with the magic number j(1≤j≤K).
In the first case, from what city you would not start our way, the distance you will pass is 0.
In the second case, you will visit cities in this order -> (2,5,1,4). Thus the maximum distance is 10.