#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
long long int p = 1e9 + 7;
long long int n, k;
long long int seq[105];
bool debugging = 0;
bool outputcheck = 0;
bool timecheck = 0;
void init() {
  if (debugging) {
  } else {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
      cin >> seq[i];
    }
  }
}
long long int modpower(long long int b, long long int po,
                       long long int mod = p) {
  long long int ans = 1;
  while (po) {
    if (po & 1) {
      ans *= b;
      ans %= mod;
    }
    b *= b;
    b %= mod;
    po >>= 1;
  }
  return ans;
}
long long int solve() {
  long long int ans[n + 1][k + 1];
  long long int sum[n + 1][k + 2];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      ans[i][j] = 0;
      sum[i][j] = 0;
    }
    sum[i][k + 1] = 0;
  }
  ans[0][0] = 1;
  for (int i = 1; i <= k + 1; i++) {
    sum[0][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (long long int j = 0; j <= k; j++) {
      ans[i][j] = sum[i - 1][j + 1] - sum[i - 1][max(0ll, j - seq[i - 1])];
      ans[i][j] %= p;
    }
    for (int j = 1; j <= k + 1; j++) {
      sum[i][j] = sum[i][j - 1] + ans[i][j - 1];
      sum[i][j] %= p;
    }
  }
  return ans[n][k] % p;
}
long long int solvebad() {}
int output() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  srand(time(0));
  while (t--) {
    init();
    if (debugging) {
      if (outputcheck) {
        if (solve() != solvebad()) {
          output();
        }
      }
      if (timecheck) {
        auto start = high_resolution_clock::now();
        solve();
        auto stop = high_resolution_clock::now();
        auto duration = duration_cast<microseconds>(stop - start);
        cout << duration.count() << " Fast\n";
        start = high_resolution_clock::now();
        solvebad();
        stop = high_resolution_clock::now();
        duration = duration_cast<microseconds>(stop - start);
        cout << duration.count() << " Slow\n";
      }
    } else {
      cout << solve() << "\n";
    }
  }
}
