ou are given π points on the π₯ axis, at increasing positive integer coordinatesβ¦
- User
ou are given π points on the π₯ axis, at increasing positive integer coordinates π₯1<π₯2<β¦<π₯π.
For each pair (π,π) with 1β€π<πβ€π, you draw the segment [π₯π,π₯π]. The segments are closed, i.e., a segment [π,π] contains the points π,π+1,β¦,π.
You are given π queries. In the π-th query, you are given a positive integer ππ, and you have to determine how many points with integer coordinates are contained in exactly ππ segments.
Input Each test contains multiple test cases. The first line contains the number of test cases π‘ (1β€π‘β€104). The description of the test cases follows.
The first line of each test case contains two integers π, π (2β€πβ€105, 1β€πβ€105) β the number of points and the number of queries.
The second line of each test case contains π integers π₯1,π₯2,β¦,π₯π (1β€π₯1<π₯2<β¦<π₯πβ€109) β the coordinates of the π points.
The third line of each test case contains π integers π1,π2,β¦,ππ (1β€ππβ€1018) β the parameters of the π queries.
It is guaranteed that the sum of π over all test cases does not exceed 105, and the sum of π over all test cases does not exceed 105.
Output For each test case, output a single line with π integers: the π-th integer is the answer to the π-th query.
Example inputCopy 3 2 2 101 200 2 1 6 15 1 2 3 5 6 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 8 254618033 265675151 461318786 557391198 848083778 6 9 15 10 6 9 4 4294967300 outputCopy 0 100 0 0 0 0 2 0 0 0 3 0 2 0 0 0 0 291716045 0 0 0 291716045 0 301749698 0 Note In the first example, you only draw the segment [101,200]. No point is contained in exactly 2 segments, and the 100 points 101,102,β¦,200 are contained in exactly 1 segment.
In the second example, you draw 15 segments: [1,2],[1,3],[1,5],[1,6],[1,7],[2,3],[2,5],[2,6],[2,7],[3,5],[3,6],[3,7],[5,6],[5,7],[6,7]. Points 1,7 are contained in exactly 5 segments; points 2,4,6 are contained in exactly 9 segments; points 3,5 are contained in exactly 11 segments.
- Assistant