#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
  int n, k;
  cin >> n;
  cin >> k;
  int dp[100005] = {0};
  dp[0] = 1;
  int counterr = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    int add[100005] = {0};
    for (int j = k; j >= 0; j--) {
      add[j + 1] = add[j + 1] + dp[j];
      add[j + 1] %= mod;
      if (j + a + 1 <= k) {
        add[j + a + 1] -= dp[j];
        add[j + a + 1] = add[j + a + 1] % mod;
      }
    }
    for (int g = 1; g <= k; g++) {
      add[g] += add[g - 1];
      add[g] = add[g] % mod;
      if (add[g] < 0) counterr++;
    }
    for (int g = 1; g <= k; g++) {
      dp[g] += add[g];
      dp[g] = dp[g] % mod;
    }
    cout << "counterr is " << counterr << endl;
    counterr = 0;
  }
  cout << dp[k];
  return 0;
}
