#include <bits/stdc++.h>
using namespace std;
long long v[105], dp[105][100005];
long long pref[105][100005];
long long mod = 1e9 + 7;
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int j = 0; j <= k; j++) {
    if (j <= v[1]) dp[1][j] = 1;
    pref[1][j] =
        ((pref[1][j] % mod + pref[1][max(0, j - 1)] % mod) % mod + (dp[1][j])) %
        mod;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j - v[i] - 1 >= 0)
        dp[i][j] =
            (dp[i][j] + pref[i - 1][j] - pref[i - 1][j - v[i] - 1]) % mod;
      else
        dp[i][j] = (dp[i][j] % mod + pref[i - 1][j] % mod);
      pref[i][j] = (pref[i][j - 1] % mod + dp[i][j] % mod) % mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
