#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
const int kInf = 1e9;
const ll kLInf = 1e18;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll kMod = 1e9 + 7;
int N, K;
int a[100010];
ll dp[105][100010];
int main() {
  cin >> N >> K;
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> a[i];
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (!i)
      for (int j = 0, j_len = (a[i] + 1); j < j_len; ++j) dp[i][j] = 1;
    ll sum[100010];
    for (int j = 0, j_len = (K + 2); j < j_len; ++j) {
      sum[j + 1] = (sum[j] + dp[i][j]) % kMod;
      42;
    }
    for (int j = 0, j_len = (K + 1); j < j_len; ++j) {
      dp[i + 1][j] = (sum[j + 1] - sum[max(0, j - a[i + 1])]) % kMod;
      42;
    }
  }
  cout << dp[N - 1][K] << endl;
  return 0;
}
