#include <bits/stdc++.h>
using namespace std;
void fastscan(int &x) {
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  if (neg) x *= -1;
}
void optimizeIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
vector<vector<long long> > dp(100005, vector<long long>(101, -1));
vector<long long> inp(101);
vector<long long> pref(101);
int main() {
  optimizeIO();
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> inp[i];
  pref[0] = inp[0];
  for (int i = 1; i < n; i++) pref[i] = pref[i - 1] + inp[i];
  for (int i = 0; i < n; i++) dp[0][i] = 1;
  for (int i = 0; i < n; i++)
    for (int j = pref[i] + 1; j < k + 1; j++) dp[j][i] = 0;
  for (int i = 1; i < k + 1; i++)
    if (i <= inp[0])
      dp[i][0] = 1;
    else
      break;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < inp[i] + 1; j++)
      dp[j][i] = (dp[j][i - 1] + dp[j - 1][i]) % 1000000007;
    for (int j = inp[i] + 1; j < k + 1; j++)
      if (dp[j][i] == -1) {
        dp[j][i] =
            (dp[j][i - 1] + dp[j - 1][i] - dp[j - inp[i] - 1][i]) % 1000000007;
        if (dp[j][i] < 0) dp[j][i] += 1000000007;
      } else {
        break;
      }
  }
  cout << (dp[k][n - 1]) % 1000000007 << endl;
  return 0;
}
