#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int maxn = 101;
const int maxk = 100001;
int n, k, upper;
int dp[maxk];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> upper;
    vector<int> sum(k + 1);
    for (int j = k; j >= 0; --j) {
      int cur = min(upper, k - j);
      int tmp = dp[j];
      int l = j + 1;
      int r = j + cur;
      if (cur > 0) {
        sum[l] = (sum[l] + tmp) % mod;
        if (r < k) {
          sum[r + 1] = (sum[r + 1] - tmp) % mod;
        }
      }
    }
    int psum = 0;
    for (int j = 0; j <= k; ++j) {
      psum = (psum + sum[j]) % mod;
      dp[j] = (dp[j] + psum) % mod;
    }
  }
  cout << dp[k] << endl;
  return 0;
}
