#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long(i) = 0; (i) < (n); (i)++) cin >> a[i];
  vector<vector<long long>> dp(n + 10, vector<long long>(100010));
  vector<vector<long long>> cum(n + 10, vector<long long>(100010));
  dp[0][0] = 1;
  for (long long(i) = 0; (i) < (n + 1); (i)++) {
    for (long long(j) = 0; (j) < (k + 10); (j)++) {
      if (i == 0) {
        if (j <= a[0]) dp[i][j] = 1;
      } else {
        dp[i][j] += (cum[i][j + 1] - cum[i][max(0LL, j - a[i])]) % MOD;
        dp[i][j] %= MOD;
      }
    }
    for (long long(j) = 0; (j) < (k + 10); (j)++) {
      cum[i + 1][j + 1] = (dp[i][j] + cum[i + 1][j]) % MOD;
    }
  }
  cout << dp[n][k] << endl;
}
