Coconut Pairs


You work at a coconut factory, and your job is to package coconuts into pairs for shipping. Two coconuts can be paired together if the absolute difference between their diameters is at most kk. Each coconut can be used in at most one pair.

Given the diameters of nn coconuts, what is the maximum number of disjoint pairs you can form?

Input

The first line contains two integers nn and kk, the number of coconuts and the maximum allowed diameter difference for a valid pair.

The second line contains nn integers, the diameters d1,d2,,dnd_1, d_2, \ldots, d_n of the coconuts.

Output

A single integer: the maximum number of disjoint coconut pairs.

Constraints

  • 1n1051 \le n \le 10^5
  • 0k1090 \le k \le 10^9
  • 1di1091 \le d_i \le 10^9

Example 1

Input 1
6 2
1 3 5 2 4 6
Output 1
3
Explanation

We can have 33 pairs of coconuts by pairing coconuts 11 and 22 (1,3)(1, 3), coconuts 33 and 66 (5,6)(5, 6), and coconuts 44 and 55 (2,4)(2, 4).

Example 2

Input 2
5 1
1 5 3 2 4
Output 2
2

Example 3

Input 3
7 0
1 3 1 2 2 5 4
Output 3
2

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.