#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110, MAXM = 1e5 + 10, MOD = 1000000000 + 7;
int read() {
  int a = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    a = a * 10 + ch - '0';
    ch = getchar();
  }
  return a * f;
}
void file(string s) {
  freopen((s + ".in").c_str(), "r", stdin),
      freopen((s + ".out").c_str(), "w", stdout);
}
int n, k;
int f[MAXN][MAXM], s[MAXN][MAXM];
int main() {
  n = read(), k = read();
  for (int i = 1; i <= k; ++i) {
    s[0][i] = 1;
  }
  s[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i][0] = s[i][0] = 1;
    int a = read();
    for (int j = 1; j <= k; ++j) {
      if (j > a) {
        f[i][j] = (s[i - 1][j] - s[i - 1][j - a - 1]) % MOD;
      } else {
        f[i][j] = s[i - 1][j] % MOD;
      }
      s[i][j] = (s[i][j - 1] + f[i][j]) % MOD;
    }
  }
  cout << f[n][k] % MOD << endl;
  return 0;
}
