#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long mod = 1e9 + 7;
void chmod(long long& M) {
  if (M >= mod)
    M %= mod;
  else if (M < 0) {
    M += (abs(M) / mod + 1) * mod;
    M %= mod;
  }
}
long long modpow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = modpow(x, n / 2);
  if (n % 2 == 0)
    return res * res % mod;
  else
    return res * res % mod * x % mod;
}
long long power(long long x, long long n) {
  if (n == 0) return 1;
  long long res = power(x, n / 2);
  if (n % 2 == 0)
    return res * res;
  else
    return res * res * x;
}
int getl(int i, int N) { return i == 0 ? N - 1 : i - 1; };
int getr(int i, int N) { return i == N - 1 ? 0 : i + 1; };
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  vector<vector<long long>> dp(110, vector<long long>(100005, 0));
  vector<long long> cum(100005, 0);
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    cum[0] = 0;
    for (int j = 1; j <= k + 1; ++j)
      cum[j] = (cum[j - 1] + dp[i - 1][j - 1]) % mod;
    for (int j = 0; j <= k; ++k)
      dp[i][j] = (cum[j + 1] - cum[max(0LL, j - a[i])] + mod) % mod;
  }
  cout << dp[n][k] << endl;
  return 0;
}
