#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long mod = 1e9 + 7;
int n, k;
int dp[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  dp[0] = 1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int lim;
    cin >> lim;
    vector<int> v(k + 1);
    for (int j = k; j >= 0; j--) {
      int l = j + 1;
      int r = j + min(lim, k - j);
      if (l <= r) {
        v[l] += dp[j];
        if (r + 1 <= k) v[r + 1] -= dp[j];
      }
    }
    int sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += v[j];
      if (sum >= mod) sum -= mod;
      dp[j] += sum;
      if (dp[j] >= mod) dp[j] -= mod;
    }
  }
  cout << dp[k];
}
