#include <bits/stdc++.h>
using namespace std;
const int MAX_N1 = 1e5 + 1000;
int n;
const int MOD = 1e9 + 7;
long long sum(int i, long long* bit) {
  int s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
void add(int i, long long x, long long* bit) {
  while (i <= n) {
    bit[i] += x;
    i += i & -i;
  }
}
const int MAX_N = 110;
const int MAX_K = 1e5 + 1;
int N, K;
vector<long long> a;
int main() {
  cin >> N >> K;
  a.resize(N);
  n = MAX_N1;
  for (int i = 0; i < N; i++) cin >> a[i];
  long long pre[MAX_N1 + 1], cur[MAX_N1 + 1];
  add(1, 1, pre);
  for (int i = 1; i <= N; i++) {
    long long tmp[MAX_N1 + 1] = {0};
    swap(cur, tmp);
    for (int j = 1; j <= K + 1; j++) {
      add(j,
          (sum(j, pre) - sum(max(j - 1 - a[i - 1], 0LL), pre) +
           (long long)MOD * (long long)1e4) %
              MOD,
          cur);
    }
    swap(cur, pre);
  }
  cout << (sum(K + 1, pre) - sum(K, pre) + MOD) % MOD << endl;
}
