#include <bits/stdc++.h>
using namespace std;
char _buf[1048576], *_is = _buf, *_it = _buf;
inline char rdc() {
  if (_is == _it) _it = (_is = _buf) + fread(_buf, 1, 1048576, stdin);
  return *_is++;
}
inline int rdi() {
  int x = 0, f = 0;
  register char ch = rdc();
  while ((ch < '0' or ch > '9') and (ch ^ '-')) ch = rdc();
  if (ch == '-') f = 1, ch = rdc();
  while (ch >= '0' and ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ '0'), ch = rdc();
  return f ? -x : x;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void _write(int x) {
  write(x);
  putchar(' ');
}
inline void print(int x) {
  write(x);
  putchar('\n');
}
int n, k, x, sum;
int dp[105][100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  int i, j;
  dp[0][0] = 1;
  for (i = 1; i <= n; ++i) {
    cin >> x;
    sum = 0;
    for (j = 0; j <= k; ++j) {
      sum += dp[i - 1][j];
      if (j > x) sum -= dp[i - 1][j - x - 1];
      if (sum >= 1000000007) sum -= 1000000007;
      dp[i][j] = sum;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
