409140: GYM103446 E Strange Integers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Strange Integerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given $$$n$$$ integers $$$A_1, A_2, \cdots, A_n$$$ and a parameter $$$k$$$, you should choose some integers $$$A_{b_1}, A_{b_2}, \cdots, A_{b_m} \, (1 \le b_1 < b_2 < \cdots < b_m \le n)$$$ so that $$$\forall 1 \le i < j \le m, |A_{b_i} - A_{b_j}| \ge k$$$. Determine the maximum number of the integers you can choose.

Input

The first line contains two integers $$$n,k\,(1 \le n \le 10^5, 0 \le k \le 10^9)$$$, denoting the number of given integers and the given parameter.

The second line contains $$$n$$$ integers $$$A_1, A_2, \cdots, A_n \, (1 \le A_i \le 10^9)$$$, denoting the given integers.

Output

Output one line containing one integer, denoting the maximum number of the integers you can choose.

ExampleInput
11 2
3 1 4 1 5 9 2 6 5 3 5
Output
4
Note

One possible scheme is to choose $$$\{A_3 = 4, A_6 = 9, A_7 = 2, A_8 = 6\}$$$.

加入题单

算法标签: