#include <bits/stdc++.h>
using namespace std;
const int BT_SIZE = 1e5 + 1000;
int n;
const int MOD = 1e9 + 7;
long long sum(int i, long long* bit) {
  long long s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
    s %= MOD;
  }
  return s;
}
void add(int i, long long x, long long* bit) {
  while (i <= n) {
    bit[i] += x;
    i += i & -i;
    bit[i] %= MOD;
  }
}
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 + 1);
  n = BT_SIZE;
  for (int i = 1; i <= N; i++) cin >> a[i];
  long long dp[MAX_N][BT_SIZE] = {0};
  add(1, 1, dp[0]);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K + 1; j++) {
      int l = max(0LL, j - 1 - a[i]);
      int r = j;
      add(j, (sum(r, dp[i - 1]) - sum(l, dp[i - 1]) + MOD * 100) % MOD, dp[i]);
    }
  }
  cout << (sum(K + 1, dp[N]) - sum(K, dp[N]) + MOD) % MOD << endl;
}
