#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
void fail() {
  std::cout << "NO\n";
  exit(0);
}
using namespace std;
long long n, k;
const long long N = 1e5 + 5;
long long dp[105][N], pre[N];
long long a[105];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long j = 0; j <= k; j++) {
    if (j <= a[1]) dp[1][j] = 1;
    pre[j] = pre[j - 1] + dp[1][j];
  }
  pre[-1] = 0;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long l = max(0LL, j - a[i]), r = j;
      dp[i][j] += pre[r];
      if (l != 0) dp[i][j] -= pre[l - 1];
      dp[i][j] %= mod;
    }
    memset(pre, 0, sizeof(pre));
    pre[0] = dp[i][0];
    for (long long j = 1; j <= k; j++) {
      pre[j] = pre[j - 1] + dp[i][j];
      pre[j] %= mod;
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
