#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)< void vprint(T &V){ for(auto v : V){ cout << v << " "; } cout << endl; } const ll mod = 1e9 + 7; const ll inf = 1e18; int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N, K; cin >> N >> K; vector A(N); FOR(i, 0, N){ cin >> A.at(i); } sort(ALL(A)); vector B(N); B[0] = 0; FOR(i, 1, N){ ll a = A[i]; ll b = K - a; auto it = upper_bound(A.begin(), A.begin()+i, b); ll over_num = distance(it, A.end()); ll num = N - over_num; B[i] = num; } ll answer = 1; FOR(i, 0, N/2){ ll index = N - 1 - i; answer *= B[index] - i; answer %= mod; if(answer <= 0){ p(0); return 0; } } p(answer); return 0; }