시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1 1 1 100.000%

문제

The ancient Babylonians decided to build a huge tower. The tower consists of N cubic building blocks that are stacked one onto another. The Babylonians gathered many building blocks of various sizes from all over the country. From their last unsuccessful attempt they have learned that if they put a large block directly onto a much smaller block, the tower will fall.

Each two building blocks are different, even if they have the same size. For each building block you are given its side length. You are also given an integer D with the following meaning: you are not allowed to put block A directly onto block B if the side length of A is strictly larger than D plus the side length of B.

Compute the number of different ways in which it is possible to build the tower using all the building blocks. Since this number can be very large, output the result modulo 109 + 9.

입력

The first line of the input contains two positive integers N and D: the number of building blocks and the tolerance respectively.

The second line contains N space-separated integers; each represents the size of one building block.

출력

Output a single line containing a single integer: the number of towers that can be built, modulo 1 000 000 009.

제한

All numbers in the input files are positive integers not exceeding 109.

N is always at least 2.

예제 입력 1

4 1
1 2 3 100

예제 출력 1

4

We can arrange the first three blocks in any order, except for 2,1,3 or 1,3,2. The last block has to be at the bottom.

예제 입력 2

6 9
10 20 20 10 10 20

예제 출력 2

36

We are not allowed to put a cube of size 20 onto a cube of size 10. There are six ways to order the cubes of size 10, and six ways to order the cubes of size 20.