/* ---------- STL Libraries ---------- */ // IO library #include #include #include #include #include // algorithm library #include #include #include #include #include // container library #include #include #include #include #include #include #include #include #include #include #include /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type ---------- */ using ll = long long; #define int ll #define P pair /* ---------- Constants */ const double PI = 3.141592653589793238462643383279; const ll MOD = 1e9 + 7; const int INF = 1LL << 55; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ signed main() { int N, K; cin >> N >> K; int A[N]; for (int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); int ptr = -1; int ret = 1; int cnt = 0; for (int i = N - 1; i >= N/2; i--) { while (A[i] + A[ptr + 1] <= K && ptr < i - 1) ptr++; if (ptr >= i) { ret *= (i - cnt) % MOD; } else { ret *= (ptr + 1 - cnt) % MOD; } ret %= MOD; cnt++; } cout << ret << endl; return 0; }