#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {0, 1, 0, -1};
const long long dy[] = {1, 0, -1, 0};
const long long inf = 0x3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
const long long N = 2e5 + 11;
long long dp[N], dp1[N], a[105], v, w, n, k, x;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> k;
  dp[0] = 1;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    for (long long j = 1; j <= k; j++) dp[j] += dp[j - 1], dp[j] %= mod;
    for (long long j = 0; j <= k; j++) {
      long long l = max(0ll, j - a[i]);
      long long r = j;
      dp1[r] = dp[r] - (l == 0 ? 0 : dp[l - 1]);
      dp1[j] %= mod;
    }
    for (long long j = 0; j <= k; j++) dp[j] = dp1[j];
  }
  return cout << dp[k], 0;
  return 0;
}
