#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
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 INF = 1LL << 60;
const int MOD = 1000000007;
int n, k;
ll dp[110][100010];
int main() {
  cin >> n >> k;
  ll a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; ++i) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
      if (j - a[i - 1] - 1 >= 0) dp[i][j] -= dp[i - 1][j - a[i - 1] - 1];
      if (dp[i][j] > MOD) dp[i][j] -= MOD;
    }
  }
  cout << dp[n][k];
  return 0;
}
