#include <bits/stdc++.h>
using namespace std;
const int MAX = 200010;
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LLINF = 1000000000000000000;
const long double EPS = 1e-7;
long long sum(vector<long long> v, int l, int r) {
  r = min(r, (int)v.size() - 1);
  long long val = v[r];
  if (l - 1 >= 0) val = (val - v[l - 1] + MOD) % MOD;
  return val;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a;
  vector<vector<long long> > tab(101, vector<long long>(100002, 0));
  a.assign(n, 0);
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  for (int j = 0; j <= a[0]; j++) {
    tab[0][j] = 1;
  }
  for (int i = 1; i < n; i++) {
    vector<long long> psum(k + 1, 0);
    long long val = 0;
    for (int j = 0; j <= k; j++) {
      val = (val + tab[i - 1][j]) % MOD;
      psum[j] = val;
    }
    for (int j = 0; j <= k; j++) {
      tab[i][j] = sum(psum, j - a[i], j);
    }
  }
  cout << tab[n - 1][k] << '\n';
  return 0;
}
