#include <bits/stdc++.h>
const int inf = 1e9 + 7;
const long double EPS = 0.00000001;
const long long modw = 1e9 + 7;
using namespace std;
long long dp[100010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  dp[0] = 1ll;
  for (int ch = 0; ch < n; ch++) {
    long long up;
    cin >> up;
    vector<long long> sub(k + 2, 0ll);
    for (int used = k; used >= 0; used--) {
      long long cur = dp[used];
      long long l = used + 1;
      long long r = min(k, used + up);
      sub[l] += cur;
      sub[r + 1] -= cur;
    }
    for (int now = 0; now <= k; now++) {
      if (now > 0) sub[now] += sub[now - 1];
      dp[now] += sub[now];
      sub[now] %= modw;
      dp[now] %= modw;
    }
  }
  cout << dp[k];
  return 0;
}
