#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  sort(a.begin(), a.end());
  for (int i = 1; i <= n; i++) {
    long long val = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      if (j > a[i]) val = (val - dp[i - 1][j - a[i] - 1]) % mod;
      dp[i][j] = (dp[i - 1][j] + val) % mod;
      val = (val + dp[i - 1][j]) % mod;
    }
  }
  cout << dp[n][k] << "\n";
}
