아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Magneti

시간 제한1초메모리 제한512 MB

요약
반지름이 주어진 n개의 자석을 l개의 빈 칸에 놓되 어떤 두 자석도 서로 끌어당기지 않도록 배치하는 경우의 수를 1e9+7로 나눈 나머지로 구한다.
난이도

보통10점 중 7점

유형
동적 계획법, 조합론, 정렬, 수학
정답자
아직 제출이 없습니다

문제

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.

힌트

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.

예제3

  1. 예제 1

    입력
    1 10
    10
    
    예상 출력
    10
    
  2. 예제 2

    입력
    4 4
    1 1 1 1
    
    예상 출력
    24
    
  3. 예제 3

    입력
    3 4
    1 2 1
    
    예상 출력
    4