#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll ll>
#define st first
#define nd second
#define pb push_back
using namespace std;
const int maxN = 1e2 + 10;
const int maxL = 1e3 + 10;
const int M = 1e9 + 7;
ll dp[maxN][maxN][10*maxL][3], a[maxN];
void solve() {
ll n, l; cin >> n >> l;
if (n == 1) {
cout << 1 << '\n';
return;
}
for (int i = 1; i <= n; ++i) cin >> a[i];
sort(a+1, a+n+1);
dp[0][0][5*l][0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
for (int k = 0; k <= 10*l; ++k) {
if (k+2*a[i] <= 10*l) {
dp[i][j][k][0] = (dp[i][j][k][0] + j*dp[i-1][j-1][k+2*a[i]][0]) % M;
dp[i][j][k][1] = (dp[i][j][k][1] + (j-1)*dp[i-1][j-1][k+2*a[i]][1]) % M;
dp[i][j][k][2] = (dp[i][j][k][2] + (j-2)*dp[i-1][j-1][k+2*a[i]][2]) % M;
}
if (k+a[i] <= 10*l) {
dp[i][j][k][1] = (dp[i][j][k][1] + 2*dp[i-1][j-1][k+a[i]][0]) % M;
dp[i][j][k][2] = (dp[i][j][k][2] + dp[i-1][j-1][k+a[i]][1]) % M;
}
dp[i][j][k][0] = (dp[i][j][k][0] + (2*j)*dp[i-1][j][k][0]) % M;
dp[i][j][k][1] = (dp[i][j][k][1] + (2*j-1)*dp[i-1][j][k][1]) % M;
dp[i][j][k][2] = (dp[i][j][k][2] + (2*j-2)*dp[i-1][j][k][2]) % M;
if (k-a[i] >= 0) {
dp[i][j][k][1] = (dp[i][j][k][1] + 2*dp[i-1][j][k-a[i]][0]) % M;
dp[i][j][k][2] = (dp[i][j][k][2] + dp[i-1][j][k-a[i]][1]) % M;
}
if (k-2*a[i] >= 0) {
dp[i][j][k][0] = (dp[i][j][k][0] + j*dp[i-1][j+1][k-2*a[i]][0]) % M;
dp[i][j][k][1] = (dp[i][j][k][1] + j*dp[i-1][j+1][k-2*a[i]][1]) % M;
dp[i][j][k][2] = (dp[i][j][k][2] + j*dp[i-1][j+1][k-2*a[i]][2]) % M;
}
}
}
}
ll ans = 0;
for (int i = 5*l; i <= 6*l; ++i) {
ans += dp[n][1][i][2];
ans %= M;
}
cout << ans << '\n';
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(NULL);
int t = 1;
// cin >> t;
while (t--) solve();
}
Compilation message
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status