#include <bits/stdc++.h>
using namespace std;
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0LL) {
    x = 0LL;
    y = 1LL;
    return b;
  }
  long long xx, yy;
  long long val = egcd(b % a, a, xx, yy);
  x = yy - (b / a) * xx;
  y = xx;
  return val;
}
long long gcd(long long a, long long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    long long p = b % a, q = a;
    a = p;
    b = q;
  }
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
vector<int> a;
const int N = 1e5 + 2, M = 101;
int dp[M][N];
void solve() {
  int n, i, j, k, l, p;
  memset((dp), 0, sizeof((dp)));
  cin >> n >> k;
  a.resize(n);
  for (auto &i : a) cin >> i;
  for (i = 0; i <= a[0]; i++) dp[0][i] = 1;
  vector<int> prev(N, 0);
  prev[0] = 1;
  for (i = 1; i <= k; i++) {
    prev[i] = dp[0][i] + prev[i - 1];
  }
  for (i = 1; i < n; i++) {
    for (j = 0; j <= k; j++) {
      dp[i][j] = prev[j];
      if (j > a[i]) dp[i][j] -= prev[j - a[i] - 1];
      dp[i][j] %= 1000000007;
    }
    prev[0] = dp[i][0];
    for (j = 1; j <= k; j++) {
      prev[j] = dp[i][j] + prev[j - 1];
      prev[j] %= 1000000007;
    }
  }
  cout << dp[n - 1][k] << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
