#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-8;
const long double PI = acos(-1);
const int N = 1e2 + 2;
const int M = 1e5 + 5;
const int mod = 1e9 + 7;
long long mem[N];
int arr[N];
int n, k;
long long diff[M];
int main() {
  cin >> n >> k;
  memset(mem, -1, sizeof mem);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<long long> dp(k + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < M; j++) diff[j] = 0;
    for (int used = k; used >= 0; used--) {
      long long tmp = dp[used];
      int L = used + 1;
      int R = used + min(arr[i], k - used);
      if (L <= R) {
        diff[L] = (diff[L] + tmp) % mod;
        if (R + 1 <= k) diff[R + 1] = (diff[R + 1] - tmp) % mod;
      }
    }
    long long prefix = 0;
    for (int j = 0; j <= k; j++) {
      prefix = (prefix + diff[j]) % mod;
      dp[j] = (dp[j] + prefix) % mod;
    }
  }
  cout << dp[k] << endl;
}
