The first line contains an integer(
), indicating that there is
test cases next.
The first line of each test cases has two positive integers(
),
(
).
Next lineintegers
(
), which representing the numbers in this sequence. The two adjacent numbers are separated by a space.
Each of the nextlines contains integers
(
), representing a subsequence being queried,
, and
are separated by a space.
The input guarantees that the sum ofdoes not exceed
and the sum of
does not exceed
.
For each test case, outputlines, each line a positive integer, indicating the answer.