#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
void solve(void) {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (int& x : A) cin >> x;
  vector<long long> dp(k + 1);
  dp[0] = 1;
  vector<long long> pre(k + 2);
  for (int i = 1; i <= k + 1; i++) pre[i] = (pre[i - 1] + dp[i - 1]) % mod;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[j] = (dp[j] + pre[j] - pre[max(0, j - A[i])]) % mod;
    }
    for (int i = 1; i <= k + 1; i++) pre[i] = (pre[i - 1] + dp[i - 1]) % mod;
  }
  cout << dp[k] << '\n';
}
int main(void) {
  solve();
  return 0;
}
