#include // https://yukicoder.me/problems/no/794 //!===========================================================!// //! dP dP dP !// //! 88 88 88 !// //! 88aaaaa88a .d8888b. .d8888b. .d888b88 .d8888b. 88d888b. !// //! 88 88 88ooood8 88' `88 88' `88 88ooood8 88' `88 !// //! 88 88 88. ... 88. .88 88. .88 88. ... 88 !// //! dP dP `88888P' `88888P8 `88888P8 `88888P' dP !// //!===========================================================!// using ld = long double; using ll = long long; std::mt19937 mt{std::random_device{}()}; template constexpr F PI() { return 3.1415926535897932385; } template std::ostream& operator<<(std::ostream& os, const std::array& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::deque& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::multimap& v) { os << "["; for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::multiset& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::map& v) { os << "["; for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::pair& v) { return (os << "<" << v.first << "," << v.second << ">"); } template std::ostream& operator<<(std::ostream& os, const std::priority_queue& v) { auto q = v; os << "["; while (not q.empty()) { os << q.top() << ",", q.pop(); } return os << "]\n"; } template std::ostream& operator<<(std::ostream& os, const std::queue& v) { auto q = v; os << "["; while (not q.empty()) { os << q.front() << ",", q.pop(); } return os << "]\n"; } template std::ostream& operator<<(std::ostream& os, const std::set& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::stack& v) { auto q = v; os << "["; while (not q.empty()) { os << q.top() << ",", q.pop(); } return os << "]\n"; } template std::ostream& operator<<(std::ostream& os, const std::unordered_multimap& v) { os << "["; for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::unordered_multiset& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::unordered_map& v) { os << "["; for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::unordered_set& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } template std::ostream& operator<<(std::ostream& os, const std::vector& v) { os << "["; for (const auto& e : v) { os << e << ","; } return (os << "]" << std::endl); } #define show(x) std::cerr << #x << " = " << (x) << std::endl //!========================================================!// //! 8888ba.88ba dP dP dP !// //! 88 `8b `8b 88 88 88 !// //! 88 88 88 .d8888b. .d888b88 88 88d888b. d8888P !// //! 88 88 88 88' `88 88' `88 88 88' `88 88 !// //! 88 88 88 88. .88 88. .88 88 88 88 88 !// //! dP dP dP `88888P' `88888P8 dP dP dP dP !// //!========================================================!// template class ModInt { private: T value; static T pow(const T p, const T n) { return p < 0 ? pow(mod + p, n) : n == 0 ? 1 : n % 2 == 1 ? pow(p, n - 1) * p % mod : pow(p * p % mod, n / 2); } static T inv(const T p) { return pow(p, mod - 2); } public: ModInt() : value{0} {} ModInt(const T val) : value{((val % mod) + mod) % mod} {} ModInt(const ModInt& n) : value{n()} {} ModInt& operator=(const ModInt& n) { return value = n(), (*this); } ModInt& operator=(const T v) { return value = (mod + v % mod) % mod, (*this); } ModInt operator+() const { return *this; } ModInt operator-() const { return ModInt{mod - value}; } ModInt operator+(const ModInt& val) const { return ModInt{value + val()}; } ModInt operator-(const ModInt& val) const { return ModInt{value - val() + mod}; } ModInt operator*(const ModInt& val) const { return ModInt{value * val()}; } ModInt operator/(const ModInt& val) const { return ModInt{value * inv(val())}; } ModInt& operator+=(const ModInt& val) { return (((value += val()) %= mod) += mod) %= mod, (*this); } ModInt& operator-=(const ModInt& val) { return (((value -= val()) %= mod) += mod) %= mod, (*this); } ModInt& operator*=(const ModInt& val) { return (((value *= val()) %= mod) += mod) %= mod, (*this); } ModInt& operator/=(const ModInt& val) { return (((value *= inv(val())) %= mod) += mod) %= mod, (*this); } ModInt operator+(const T val) const { return ModInt{value + val}; } ModInt operator-(const T val) const { return ModInt{value - val}; } ModInt operator*(const T val) const { return ModInt{value * val}; } ModInt operator/(const T val) const { return ModInt{value * inv(val)}; } ModInt& operator+=(const T val) { return (((value += val) %= mod) += mod) %= mod, (*this); } ModInt& operator-=(const T val) { return (((value -= val) %= mod) += mod) %= mod, (*this); } ModInt& operator*=(const T val) { return (((value *= val) %= mod) += mod) %= mod, (*this); } ModInt& operator/=(const T val) { return (((value *= inv(val)) %= mod) += mod) %= mod, (*this); } bool operator==(const ModInt& val) const { return value == val.value; } bool operator!=(const ModInt& val) const { return not(*this == val); } bool operator==(const T val) const { return value == (mod + val % mod) % mod; } bool operator!=(const T val) const { return not(*this == val); } T operator()() const { return value; } }; template inline ModInt operator+(const T val, const ModInt& n) { return ModInt{n() + val}; } template inline ModInt operator-(const T val, const ModInt& n) { return ModInt{-n() + val}; } template inline ModInt operator*(const T val, const ModInt& n) { return ModInt{n() * val}; } template inline ModInt operator/(const T val, const ModInt& n) { return ModInt(val) / n; } template inline bool operator==(const T val, const ModInt& n) { return n == val; } template inline bool operator!=(const T val, const ModInt& n) { return not(val == n); } template inline std::istream& operator>>(std::istream& is, ModInt& n) { T v; return is >> v, n = v, is; } template std::ostream& operator<<(std::ostream& os, const ModInt& n) { return (os << n()); } template using mint = ModInt; template using mll = ModInt; constexpr ll MOD = 1000000007; int main() { int N; ll K; std::cin >> N >> K; std::vector A(N); for (int i = 0; i < N; i++) { std::cin >> A[i]; } std::sort(A.begin(), A.end()); mll ans = 1; for (int i = N - 1; i >= N / 2; i--) { const ll R = K - A[i]; int sup = std::upper_bound(A.begin(), A.end(), R) - A.begin(); sup = std::min(sup, i); ans *= (sup - (N - i - 1)); } std::cout << ans << std::endl; return 0; }