Log Jumping
Time limit1sMemory limit128 MB
Find the largest set of equal-length logs that can be visited in a closed tour where jumps are allowed between logs whose segments share a point.
Statement
The villagers keep a set of exercise facilities in the forest behind our village. One of them is made of many logs laid out along a straight trail. Every log has the same length and lies parallel to the trail.
"Log jumping" is a well-known game played there. It is a test of concentration whose goal is to step on as many logs as possible under the rules below.
- Choose any log and stand on it. Standing on a log counts as visiting it, and you may walk freely along the log you are currently on.
- Choose a log you have not visited yet and jump onto it. Every jump must be made in the direction perpendicular to the logs. Repeat this step as many times as you like.
- The last log you land on must be the log you started from. Except for that first-and-last log, each log may be visited at most once. The game ends as soon as you return to the starting log.
For example, suppose there are eight logs of length , numbered to , as in the figure below. Starting on log you may jump to log , then log , log , log , and finally back to log , visiting five logs in total. No route of this kind visits more than five logs, so the maximum here is five. 
Given the length of the logs and the position of each log, help Ha-Jin find the largest number of logs she can visit. Two logs are reachable from each other whenever the horizontal segments they occupy share at least one point. In particular, if the right end of one log has the same coordinate as the left end of another, you may jump between the two in either direction. In the figure, for instance, you may jump between log and log .
Input
The input is read from standard input. The first line contains the number of test cases . Each test case consists of two lines. The first line has two integers and , the number of logs and their common length (, ). The second line has integers separated by single spaces, where is the x-coordinate of the left end of the -th log (). Each log therefore occupies the segment from to .
Output
Write to standard output. For each test case, print a single line containing the maximum number of logs that can be visited.