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

문제

The International Olympiad in Informatics will be held in Tsukuba City, Japan. In order to prepare for IOI, we are planning to construct skyscraper buildings in the main street of Tsukuba City. Since we want to create a new sightseeing spot, the buildings have to satisfy the following conditions.

We are planning to construct N buildings along a straight line in the main street. The heights of them are A1, A2, A3, . . . , AN. They are different from each other. Since the order of N buildings are not yet decided, we can permute their heights if necessary. We will decorate them for IOI. Due to the constraints of materials used for decoration, the sum of the absolute values of the differences of the heigts of two adjacent buildings must be less than or equal to L. In other words, if the heights of the buildings from one side of the main street are f1, f2, f3, . . . , fN, we must have |f1 − f2| + |f2 − f3| + . . . + |fN−1 − fN| ≤ L. Here, |x| is the absolute value of x.

How many permutations of buildings satisfy the above condition?

Given the number N of buildings, their heights, and the upper limit L of the sum of the absolute values of the differences of the heigts of two adjacent buildings, write a program which calculates the number of permutations of buildings satisfying the condition. Since this number can be too big, output the remainder of division of it by 1 000 000 007.

입력

Read the following data from the standard input.

  • The first line of input contains two space separated integers N, L. This means the number of buildings is N, and the upper limit of the sum of the absolute values of the differences of the heigts of two adjacent buildings is L.
  • The second line contains N space separated integers A1, A2, A3, . . . , AN. This means the height of the i-th building (1 ≤ i ≤ N) is Ai.

출력

The output consists of one line. It contains an integer, the remainder of division of the number of permutations of buildings satisfying the condition by 1 000 000 007.

제한

All input data satisfy the following conditions.

  • 1 ≤ N ≤ 100.
  • 1 ≤ L ≤ 1 000.
  • 1 ≤ Ai ≤ 1 000 (1 ≤ i ≤ N).
  • Ai ≠ Aj (1 ≤ i < j ≤ N).

서브태스크 1 (5점)

  • N ≤ 8.

서브태스크 2 (15점)

  • N ≤ 14.
  • L ≤ 100.

서브태스크 3 (80점)

There are no additional constraints.

예제 입력 1

4 10
3 6 2 9

예제 출력 1

6

There are 24 permutations in total. Among them, there are 6 permutations for which the sums of the absolute values of the differences of the heigts of two adjacent buildings are less than or equal to 10.

  • If f1 = 2, f2 = 3, f3 = 6, f4 = 9, we have |2 − 3| + |3 − 6| + |6 − 9| = 7.
  • If f1 = 2, f2 = 3, f3 = 9, f4 = 6, we have |2 − 3| + |3 − 9| + |9 − 6| = 10.
  • If f1 = 3, f2 = 2, f3 = 6, f4 = 9, we have |3 − 2| + |2 − 6| + |6 − 9| = 8.
  • If f1 = 6, f2 = 9, f3 = 3, f4 = 2, we have |6 − 9| + |9 − 3| + |3 − 2| = 10.
  • If f1 = 9, f2 = 6, f3 = 2, f4 = 3, we have |9 − 6| + |6 − 2| + |2 − 3| = 8.
  • If f1 = 9, f2 = 6, f3 = 3, f4 = 2, we have |9 − 6| + |6 − 3| + |3 − 2| = 7.

예제 입력 2

8 35
3 7 1 5 10 2 11 6

예제 출력 2

31384

채점

  • 예제는 채점하지 않는다.