Processing math: 100%
Brewing potion 3 - MarisaOJ: Marisa Online Judge

Brewing potion 3

Time limit: 1000 ms
Memory limit: 256 MB
Marisa has n mushrooms, ith mushroom weigh Ai. Today she wants to make a potion bottle. She can use an arbitrary numbers of mushrooms in a potion bottle but two mushrooms that differ in weight by more than k cannot be used in the same potion bottle. What is the maximum number of mushrooms that can be used to make **two** potion bottle? (Marisa wants her potion to be as strong as possible). ### Input - The first line contains two integers n,k. - The second line contains n integers Ai. ### Output - The maximum number of mushrooms can be used. ### Constraints - 1≤n≤105. - 1≤k,Ai≤109 ### Example Input: 631257910 Output: 5