#include <bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 60);
const int 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;
}
int N, K;
vector<int> a(110);
vector<vector<long long> > dp(110, vector<long long>(100010, 0));
int main() {
  cin >> N >> K;
  for (int i = 0; i < (int)N; i++) {
    cin >> a[i];
  }
  vector<long long> sum(K + 1, 0);
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    sum[0] = 0;
    for (int j = 0; j <= K; j++) sum[j + 1] = (sum[j] + dp[i][j]) % MOD;
    for (int j = 0; j <= K; j++)
      dp[i + 1][j] = (sum[j + 1] - sum[max(0, j - a[i])] + MOD) % MOD;
  }
  cout << dp[N][K] << endl;
}
