Given an array of n integers which may contain duplicate elements, an element of this array is given to us, we need to tell the final position of this element in the array, if a stable sort algorithm is applied.(Index of the number is given as idx)
The first line of input contains an integer T denoting the number of test cases. Each test case contains two integers n and idx. Next line contains space separated n elements in the array a.
Print the index(0 based indexing) of the element after a stable sort operation.
3 4 3 5 2 3 4 3 1 5