#P1610. 鸿山洞的灯

鸿山洞的灯

Description

There are nn lamps with positions pip_i, and all pip_i are distinct. When the distance between two lamps is less than distdist, if there is still a lamp that remains on within this safety distance, you may turn off those lamps (that is, if the distance between the (i1)(i-1)-th and (i+1)(i+1)-th lamps is dist\leq dist, then the ii-th lamp can be turned off).

While ensuring that the cave remains sufficiently illuminated, find the maximum number of lamps that can be removed within a single contiguous interval.

The lamps nearest to and farthest from the cave entrance must remain on.

Input Format

The first line contains two numbers, nn and distdist.

The second line contains nn numbers, the positions pip_i of each lamp.

Output Format

Output one number: the maximum number of lamps that can be removed within a single interval.

3 3
1 2 3
1

Hint

For 100%100\% of the testdata, 1n1051 \leq n \leq 10^5, and distdist is guaranteed to be within the range of int.

Translated by ChatGPT 5