#include #include using namespace std; typedef long long ll; ll N,K,A[200010] = {},inf = 1e9+7; ll func[200010] = {0}; ll inv[200010] = {0}; ll mult(ll n, ll m){ if(m==1) return n%inf; else if(m%2==0){ ll t = mult(n,m/2); return (t*t)%inf; }else{ ll t = mult(n,m-1); return (t*n)%inf; } } void factorial(ll N){ for(ll i=0;i<=N;i++){ if(i==0){ func[i] = 1; inv[i] = 1; } else{ func[i] = (i*func[i-1])%inf; inv[i] = mult(func[i],inf-2); } } } int main(){ cin >> N >> K; factorial(N); for(int i=1;i<=N;i++){ cin >> A[i]; } sort(A+1,A+N+1,greater()); ll ans = 1; ll r = N+1; for(ll i=1;i<=N;i++){ while(A[i]+A[r-1]<=K && i0){ (ans *= (num*(num-1)/2)%inf)%=inf; num -= 2; } break; } (ans *= N-r+1-(i-1))%=inf; } cout << ans << endl; }