#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int dat[100005];
int sum[2][100005];
int mod = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> dat[i];
  }
  sum[0][0] = sum[1][0] = 1;
  for (int i = 1; i <= m; i++) {
    sum[0][i] = 1;
  }
  bool t = true;
  for (int i = 1; i <= n; i++, t = !t) {
    for (int j = 1; j <= m; j++) {
      if (j <= dat[i]) {
        sum[t][j] = (sum[t][j - 1] + sum[!t][j]) % mod;
      } else {
        sum[t][j] =
            (sum[t][j - 1] + sum[!t][j] - sum[!t][j - dat[i] - 1] + mod) % mod;
      }
    }
  }
  cout << (sum[0][m] + sum[1][m] - sum[0][m - 1] - sum[1][m - 1] + mod) % mod;
  return 0;
}
