#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dp[100001];
void add(long long &a, long long b) {
  a += b;
  if (a > mod) a -= mod;
}
void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += mod;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, k, ai;
  cin >> n >> k;
  dp[0] = 1;
  for (long long child = 1; child <= n; ++child) {
    cin >> ai;
    vector<long long> sum(k + 2);
    for (long long used = k; used >= 0; --used) {
      long long val = dp[used];
      long long l = used + 1;
      long long r = min(k, used + ai);
      add(sum[l], val);
      sub(sum[r + 1], val);
    }
    long long pref = 0;
    for (long long i = 0; i <= k; ++i) {
      add(pref, sum[i]);
      add(dp[i], pref);
    }
  }
  cout << dp[k] << endl;
}
