#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int sub(int a, int b) { return (a -= b) >= 0 ? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
  if (p == 0) return 1;
  if (p & 1) return mul(a, pwr(a, p - 1));
  return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }
int n, k, a[100], dp[100002], ndp[100002];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  dp[0] = 1;
  for (int i = n - 1; i >= 0; --i) {
    for (int q = 1; q <= k; ++q) adds(dp[q], dp[q - 1]);
    for (int r = 1; r <= k; ++r) {
      int l = r - min(a[i], r);
      int s = (l == 0 ? 0 : dp[l - 1]);
      ndp[r] = sub(dp[r], s);
    }
    memcpy(dp, ndp, sizeof dp);
  }
  cout << dp[k];
}
