#include <bits/stdc++.h>
using namespace std;
mt19937 rnd;
const long long mod = 1e9 + 7;
const int maxn = 100 + 5, maxk = 1e5 + 5;
long long dp[maxn][maxk];
long long pref[maxn][maxk];
long long a[maxn];
long long pref2[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long k;
  cin >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) pref2[i] = pref2[i - 1] + a[i];
  for (int i = 0; i <= a[1]; i++) dp[1][i] = 1;
  pref[1][0] = 1;
  for (int i = 1; i <= k; i++) pref[1][i] = pref[1][i - 1] + dp[1][i];
  for (int i = 2; i <= n; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= a[i]; j++) {
      dp[i][j] = pref[i - 1][j] % mod;
    }
    for (int j = a[i] + 1; j <= min(k, pref2[i]); j++) {
      dp[i][j] = (pref[i - 1][j] - pref[i - 1][j - a[i] - 1]) % mod;
    }
    pref[i][0] = dp[i][0];
    for (int j = 1; j <= k; j++) pref[i][j] = (pref[i][j - 1] + dp[i][j]) % mod;
  }
  cout << dp[n][k] << '\n';
  return 0;
}
