#include <bits/stdc++.h>
using namespace std;
const long long int N = 105;
const long long int K = 100005;
long long int dp[N][K];
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n + 1);
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  vector<long long int> pref(k + 1, 1);
  for (long long int i = 1; i <= n; i++) {
    vector<long long int> p(k + 1);
    p[0] = 1;
    for (long long int j = 1; j <= k; j++) {
      dp[i][j] = (1000000007 + pref[j] -
                  (j - a[i] - 1 >= 0 ? pref[j - a[i] - 1] : 0)) %
                 1000000007;
      p[j] = (p[j - 1] + dp[i][j]) % 1000000007;
    }
    pref = p;
  }
  cout << dp[n][k] % 1000000007;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int T = 1;
  for (long long int TT = 1; TT <= T; TT++) {
    solve();
  }
}
