#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int MAXN = 100005;
int n, k;
const int mod = 1e9 + 7;
int a[105];
long long ft[MAXN + 1];
void upd(int i0, long long v) {
  for (int i = i0 + 1; i <= MAXN; i += i & -i) ft[i] += v;
}
long long get(int i0) {
  long long r = 0;
  for (int i = i0; i; i -= i & -i) r += ft[i];
  return r;
}
long long get_sum(int i0, int i1) {
  long long r = get(i1) - get(i0);
  return r;
}
int main() {
  cin >> n >> k;
  for (int i = 0, qwerty = n; i < qwerty; i++) cin >> a[i];
  for (int i = 0, qwerty = a[n - 1] + 1; i < qwerty; i++) upd(i, 1);
  for (int i = n - 2; i >= 0; i--) {
    vector<long long> v;
    for (int j = 0, qwerty = k + 1; j < qwerty; j++) {
      int x = max(0, j - a[i]);
      int y = j;
      v.push_back(get_sum(x, y + 1));
    }
    memset(ft, 0, sizeof ft);
    for (int j = 0, qwerty = k + 1; j < qwerty; j++) upd(j, v[j]);
  }
  long long r = get_sum(k, k + 1) % mod;
  if (r < 0) r += mod;
  cout << r << "\n";
}
