#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  ll mod = 1e9 + 7, s = 0;
  ll dp[110][100010] = {0};
  dp[0][k] = 1;
  for (int i = (1); i < (n + 1); i++)
    for (int j = 0; j < (k + 1); j++) {
      if (j == 0) {
        s = 0;
        for (int l = 0; l < (a[i - 1] + 1); l++) {
          s += dp[i - 1][l];
          s %= mod;
        }
      } else
        s += (dp[i - 1][j + a[i - 1]] - dp[i - 1][j - 1]);
      dp[i][j] += s;
      dp[i][j] %= mod;
    }
  cout << dp[n][0] << endl;
  return 0;
}
