#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> a(n), b(n);
  vector<int> dp(1e5 + 10, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < a[0] + 1; i++) dp[i] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j - a[i] < 0)
        (dp[j] += dp[j - 1]) %= mod;
      else
        dp[j] = (dp[j] + dp[j - 1] - a[j - a[i]] + mod) % mod;
    }
  }
  cout << dp[k] << endl;
  return 0;
}
