#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  long long x = 0;
  char c = getchar();
  bool neg = false;
  while (c != '-' && ('0' > c || c > '9')) c = getchar();
  if (c == '-') neg = true, c = getchar();
  while ('0' <= c && c <= '9') x = 10 * x + c - '0', c = getchar();
  if (neg) x = -x;
  return x;
}
inline void out(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) out(x / 10);
  putchar(x % 10 + '0');
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r) { return l + rng() % (r - l + 1); }
const int N = 110;
const int M = 1e9 + 7;
int n, m;
int a[N], s[N];
int f[N][100010];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  ;
  cin >> n >> m;
  for (int i = 1, _c = n; i <= _c; ++i) cin >> a[i];
  for (int i = 0, _c = m; i <= _c; ++i) s[i + 1] = 1;
  for (int i = 1, _c = n; i <= _c; ++i) {
    for (int j = 0, _c = m; j <= _c; ++j)
      f[i][j] = (s[j + 1] - s[max(0, j - a[i]) - 1 + 1] + M) % M;
    for (int j = 0, _c = m; j <= _c; ++j)
      s[j + 1] = (f[i][j] + s[j - 1 + 1]) % M;
  }
  cout << f[n][m];
}
