#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;

int main(){
	int n,T;
	cin>>n>>T;
	vector<int> v(n);
	for(int i=0;i<n;i++) cin>>v[i];
	sort(v.begin(),v.end());
	int p = 0;
	vector<long long> dp(n+1);
	dp[0] = 1;
	for(int i=0;i<n;i++){
		while(p < n && v[p]-v[i]<=T) p++;
		dp[i+1] = dp[i] * (p-i) % MOD;
	}
	cout << dp[n] << endl;
}