#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using int64 = long long; using int128 = __int128; #define repeat(i, n) for (auto i = decltype(n)(); (i) < (n); (i)++) const int64 mod = 1e9 + 7; int64 powMod(int64 a, int64 b) { int64 res = 1, p = a % mod; while (b > 0) { if (b & 1) (res *= p) %= mod; (p *= p) %= mod; b >>= 1; } return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N; int64 K; cin >> N >> K; vector A(N); repeat (i, N) { cin >> A[i]; } sort(A.begin(), A.end()); vector factorial(N + 1, 1); for (int i = 2; i <= N; i++) { factorial[i] = (i * factorial[i - 1]) % mod; } int64 ub = 0, ans = 1; for (int i = N - 1; i > ub; i--) { while (ub < i and A[i] + A[ub] <= K) ub++; if (i == ub) { // 残りは2i-N+2個 int num = 2 * i - N + 2; (ans *= (factorial[num] * powMod(powMod(2, mod - 2), num / 2)) % mod) %= mod; (ans *= powMod(factorial[num / 2], mod - 2)) %= mod; break; } else { (ans *= max(0LL, ub - (N - 1 - i))) %= mod; } } cout << ans << endl; return 0; }