#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k, a[200];
long long dp[1000000][110], pref[1000000];
long long sum(int l, int r) {
  if (l <= 0) return pref[r];
  return pref[r] - pref[l - 1];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) dp[0][i] = 1;
  for (int cand = 1; cand <= k; cand++) dp[cand][0] = a[0] < cand ? 0 : 1;
  pref[0] = dp[0][0];
  for (int j = 1; j <= k; j++) pref[j] = (pref[j - 1] + dp[j][0]) % mod;
  for (int i = 1; i < n; i++) {
    for (int cand = 1; cand <= k; cand++) dp[cand][i] = sum(cand - a[i], cand);
    pref[0] = dp[0][i];
    for (int j = 1; j <= k; j++) pref[j] = (pref[j - 1] + dp[j][i]) % mod;
  }
  cout << dp[k][n - 1];
  return 0;
}
