eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Rabbit Game Playing

Rabbit Game Playing

Honestly, a rabbit does not matter. There is a rabbit playing a stage system action game. In this game, every stage has a diffculty level. The rabbit, which always needs challenges, basically wants to play more diffcult stages than he has ever played. However, he sometimes needs rest too. So, to compromise, he admitted to play \textbf{T} or less levels easier stages than the preceding one. How many ways are there to play all the stages at once, while honoring the convention above? Maybe the answer will be a large number. So, let me know the answer modulo \textbf{1000000007}. \InputFile The first line of input contains two integers \textbf{N} and \textbf{T} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100000}, \textbf{1} ≤ \textbf{T} ≤ \textbf{100000}). \textbf{N} is the number of stages, and \textbf{T} is the compromise level. The following \textbf{N} lines describe the diffculty levels of each stage. The \textbf{i}^th line contains one integer \textbf{D_i} (\textbf{1} ≤ \textbf{D_i} ≤ \textbf{100000}), which is the diffculty level of the \textbf{i}^th stage. \OutputFile Calculate how many ways to play all the stages at once there are. Print the answer modulo \textbf{1000000007} in a line.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3 1
1
2
3
Вихідні дані #1
4
Джерело The 2011 35th Annual ACM Programming Contest Winter Camp