#include <bits/stdc++.h>
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll dp[105][100005];
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n + 1);
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i + 1];
  for (int i = k; i >= max(0LL, k - a[1]); i--) {
    dp[1][i] = 1;
  }
  for (int i = 1; i < n; i++) {
    vector<ll> sum(k + 1, 0);
    sum[0] = dp[i][0];
    for (int j = 1; j <= k; j++) {
      sum[j] += sum[j - 1] + dp[i][j];
    }
    for (int j = 0; j <= k; j++) {
      dp[i + 1][j] = sum[min((ll)k, (ll)j + a[i + 1])] - (j ? sum[j - 1] : 0);
    }
  }
  cout << dp[n][0] % MOD << endl;
  return 0;
}
