#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
void Main() {
  int MOD = 1000000007;
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  for (int i = 0; i < (N + 1); ++i) {
    dp[i][0] = 1;
  }
  vector<vector<long long>> sums(N, vector<long long>(K + 2, 0));
  for (int i = 0; i < (K + 1); ++i) {
    sums[0][i + 1] = dp[0][i] + sums[0][i];
  }
  for (int i = 0; i < (N); ++i) {
    for (int j = (1); j < (K + 1); ++j) {
      dp[i + 1][j] = sums[i][j + 1] - sums[i][j - A[i] >= 0 ? j - A[i] : 0];
    }
    if (i == N - 1) break;
    for (int j = 0; j < (K + 1); ++j) {
      sums[i + 1][j + 1] = (dp[i + 1][j] + sums[i + 1][j]) % MOD;
    }
  }
  cout << dp[N][K] << endl;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
