#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
void EducationalDP_M() {
  const ll MOD = 1000000007;
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (auto& x : a) cin >> x;
  sort(a.begin(), a.end());
  vvl dp(N, vl(K + 1));
  for (int j = 0; j <= a[0]; ++j) dp[0][j] = 1;
  vl tmp(K + 1);
  for (int i = 1; i < N; ++i) {
    tmp[0] = dp[i - 1][0] % MOD;
    for (int j = 1; j <= K; ++j) tmp[j] = (tmp[j - 1] + dp[i - 1][j]) % MOD;
    for (int j = 0; j <= K; ++j) {
      int k = max(j - a[i], 0) - 1;
      dp[i][j] = tmp[j] - (k > -1 ? tmp[k] : 0);
      dp[i][j] %= MOD;
    }
  }
  cout << dp[N - 1][K] << endl;
}
int main() {
  EducationalDP_M();
  return 0;
}
