US group - no more than

Title Description

Given a sequence comprising a sequence of n positive integers A, you can delete a number from the number, so that the difference between maximum and minimum values ​​of the remaining number does not exceed x, ask how many digits minimum deleted.

 

Input Requirements

Input of the first line contains only two positive integers n and x, represents the length of a given positive integer and the sequence given. (1 <= n <= 1000,1 <= x <= 10000)

The next line has n positive integer, i.e. this sequence, separated by a space. (1 <= a_i <= 10000)

 

Output requirements

The output contains only an integer that represents the minimum number of deleted numbers.

 

If the input

 5 2

 2 1 3 2 5

It should be output

1

prompt

* In extreme cases, when deleting the remaining number 1, the difference between the maximum value and the minimum value is 0, it does not occur without solution.

Guess you like

Origin www.cnblogs.com/lwp-nicol/p/12622622.html