#include <bits/stdc++.h>
const double PI = acos(-1);
const double EPS = 1e-12;
const long long MOD = 1e9 + 7;
const int INF = 1 << 30;
using namespace std;
long long dat[100005];
long long cnt[105][100005];
long long summ[105][100005];
int main() {
  int in, n;
  cin >> in >> n;
  for (int i = 1; i <= in; i += 1) {
    cin >> dat[i];
  }
  for (int i = in; i >= 1; i--) {
    if (i == in) {
      for (int j = 0; j <= n; j += 1) {
        if (j <= dat[i]) {
          cnt[i][j] = 1;
        }
        if (j == 0)
          summ[i][j] = cnt[i][j] % MOD;
        else
          summ[i][j] = (summ[i][j - 1] + cnt[i][j]) % MOD;
      }
    } else {
      for (int j = 0; j <= n; j += 1) {
        if (j <= dat[i]) {
          cnt[i][j] = summ[i + 1][j];
        } else {
          cnt[i][j] = summ[i + 1][j] - summ[i + 1][j - dat[i] - 1];
        }
        if (j == 0)
          summ[i][j] = cnt[i][j] % MOD;
        else
          summ[i][j] = (summ[i][j - 1] + cnt[i][j]) % MOD;
      }
    }
  }
  cout << cnt[1][n] << endl;
  return 0;
}
