问题3287--Counting Sequences

3287: Counting Sequences

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

For a set of sequences of integers{a1,a2,a3,...an}, we define a sequence{ai1,ai2,ai3...aik}in which 1<=i1= 2, and the neighboring 2 elements have the difference not larger than d, it will be defined as a Perfect Sub-sequence. Now given an integer sequence, calculate the number of its perfect sub-sequence.

输入

Multiple test cases The first line will contain 2 integers n, d(2<=n<=100000,1<=d=<=10000000) The second line n integers, representing the suquence

输出

The number of Perfect Sub-sequences mod 9901

样例输入 Copy

4 2
1 3 7 5

样例输出 Copy

4