You are given an array containing N integers and you have to answer K queries. Each query contains an integer X which is the index of the ith (1 based index) element of the queue.
Write a program to determine the following for each query:
Note:
Segment formation example: You have 3 numbers 1, 2, and 3.
The possible segments for 3 are [3], [2,3] and [1,2,3]. Similarly, the possible segments for 2 are [2],[1,2].
Input format
Output format
Print the answer to each query.
Constraints
1≤T≤50
1≤N,K≤105
1≤Each element of the queue≤109
1≤X≤N
For first query all possible valid segments are [4], [4,1] ,[4,1,2] , [4,1,2,3] hence answer is 4.