시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB1000.000%

문제

Little Marko is bored of playing with shady cryptocurrencies such as Shiba Inu or XRC, which is why he decided to play with magnets. He has n different magnets and a board which has l available empty slots in a row, in which the magnets can be placed. Each pair of adjacent slots is exactly one centimeter apart. Each of the n magnets has a radius of activity that is equal to ri. This means that it will attract all magnets that are located strictly less than ri centimeters away (regardless of the radius of activity of the other magnet). It is possible that some magnets have the same radius of activity, but they are considered as different magnets.

Marko doesn’t like it when the magnets attract each other, so he is interested in the number of ways to place the magnets on the board so that no magnet attracts any other. All of the magnets should be placed on the board, and each empty slot may contain at most one magnet. Two ways of placing the magnets are considered different if there is magnet which is at a different position in the first way than in the second way. As the required number can be quite large, you should output it modulo 109 + 7.

입력

The first line contains positive integers n and l, the number of magnets and the number of empty slots.

The second line contains n positive integers ri (1 ≤ ri ≤ l), the radii of activity of the n magnets.

출력

Print the required number of ways to place the magnets on the board so that no magnet attracts any other, modulo 109 + 7.

제한

In every subtask, it holds that 1 ≤ n ≤ 50 and n ≤ l ≤ 10 000.

서브태스크

번호 배점 제한
1 10

r1 = r2 = ... = rn

2 20

1 ≤ n ≤ 10

3 30

1 ≤ n ≤ 30, n ≤ l ≤ 300

4 50

No additional constraints.

예제 입력 1

1 10
10

예제 출력 1

10

예제 입력 2

4 4
1 1 1 1

예제 출력 2

24

예제 입력 3

3 4
1 2 1

예제 출력 3

4

힌트

Clarification of the second example: All permutations of the magnets are valid because no two magnets can attract each other.

Clarification of the third example: If we denote the magnets with 1, 2 and 3, and an empty slot with _, the possible arrangements of magnets are 13_2, 31_2, 2_13 and 2_31.

채점 및 기타 정보

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