#include <bits/stdc++.h>
using namespace std;
long long int dp[104][100004];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    long int i, n, j, k;
    cin >> n >> k;
    long int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    std::vector<long long int> pref(k + 1);
    for (j = 0; j < k + 1; j++) {
      if (j > a[0]) break;
      dp[0][j] = 1;
    }
    for (i = 1; i < n; i++) {
      pref[0] = dp[i - 1][0];
      for (j = 1; j < k + 1; j++) {
        pref[j] = pref[j - 1] + dp[i - 1][j];
        pref[j] %= 1000000007;
      }
      for (j = 0; j < k + 1; j++) {
        if (max((long int)0, j - a[i] - 1) == 0 && j - a[i] - 1 < 0)
          dp[i][j] += pref[j];
        else
          dp[i][j] += pref[j] - pref[max((long int)0, j - a[i] - 1)];
      }
    }
    cout << dp[n - 1][k];
  }
  return 0;
}
