#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

const int MOD = 1e9 + 7;

int main() {
	int n, k; scanf("%d%d", &n, &k); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(begin(a), end(a));
	
	int K = 0;
	auto dp = make_v<i64>(n + 1, k + 2); dp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j <= K; j++) {
			int L = j, R = std::min(k + 1, j + a[i] + 1);
			(dp[i + 1][L] += dp[i][j]) %= MOD;
			(dp[i + 1][R] += MOD - dp[i][j]) %= MOD;
		}
		K = std::min(k, K + a[i]);
		
		for(int j = 0; j <= K; j++) (dp[i + 1][j + 1] += dp[i + 1][j] %= MOD) % MOD;
	}
	
	printf("%lld\n", dp[n][k]);
	return 0;
}
