#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int maxk = 100100;
const long long mod = 1e9 + 7;
long long n, k;
long long a[maxn];
long long dp[maxk];
long long pref[maxk];
int main() {
  cin >> n >> k;
  cin >> a[1];
  for (int i = 0; i <= a[1]; i++) {
    dp[i] = 1LL;
  }
  pref[0] = dp[0];
  for (int i = 1; i <= k; i++) {
    pref[i] = pref[i - 1] + dp[i];
  }
  for (int i = 2; i <= n; i++) {
    cin >> a[i];
    memset(dp, 0, sizeof(dp));
    for (int j = k; j >= 0; j--) {
      if (j - a[i] <= 0) {
        dp[j] += pref[j];
        dp[j] %= mod;
      } else
        dp[j] += pref[j] - pref[j - a[i]];
      dp[j] %= mod;
    }
    pref[0] = dp[0];
    for (int j = 1; j <= k; j++) {
      pref[j] = pref[j - 1] + dp[j];
      pref[j] %= mod;
    }
  }
  cout << dp[k] << "\n";
}
