loj#P3569. 「COCI 2021.11」磁铁

「COCI 2021.11」磁铁

Description

Problem from COCI 2021/2022 Contest #2 T4 Magnet

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 nn different magnets and a board which has ll 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 nn magnets has a radius of activity that is equal to rir_i. This means that it will attract all magnets that are located strictly less than rir_i 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+710^9 + 7.

Input

The first line contains positive integers nn and ll, the number of magnets and the number of empty slots.

The second line contains n positive integers rir_i (1ril)(1 \le r_i \le l), the radii of activity of the nn magnets.

Output

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

1 10
10
10
4 4
1 1 1 1
24
3 4
1 2 1
4

Limits And Hints

In every subtask, it holds that 1n501 \le n \le 50 and nl10000n \le l \le 10 000.

Subtask Points Constraints
11 1010 r1=r2==rnr_1=r_2=\ldots=r_n
22 2020 1n101\le n\le 10
33 3030 1n30, nl3001\le n\le 30,~n\le l\le 300
44 5050 No additional constraints