#include <bits/stdc++.h>
using namespace std;
const long long I1 = 1e9;
const long long I2 = 1e18;
const int32_t M1 = 1e9 + 7;
const int32_t M2 = 998244353;
template <typename T, typename T1>
T maxn(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T minn(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
long long int dp[105][100005];
void add(long long int &a, long long int b) { (a += b) %= M1; }
void solve() {
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 1; i <= k + 1; i++) dp[0][i] = 1;
  for (long long int i = 1; i <= n; i++) {
    long long int val;
    cin >> val;
    for (long long int used = 0; used < k + 1; used++) {
      add(dp[i][used + 1],
          dp[i - 1][used + 1] - dp[i - 1][used - min(used, val)] + dp[i][used]);
    }
  }
  cout << (dp[n][k + 1] - dp[n][k]) % M1 << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  while (testcase--) solve();
  return 0;
}
