#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const long long mod = 1000000007;
using namespace std;
int N, K;
int cnt[maxn];
long long f[111][maxn], pre[maxn];
long long solve() {
  for (int i = 0; i <= K; i++) f[1][i] = (i <= cnt[1]) ? 1 : 0;
  for (int i = 2; i <= N; i++) {
    memset(pre, 0, sizeof pre);
    pre[0] = f[i - 1][0];
    for (int j = 1; j <= K; j++) pre[j] = (f[i - 1][j] + pre[j - 1]);
    for (int j = K; j >= 0; j--) {
      if (j - cnt[i] >= 0)
        f[i][j] = pre[j] - pre[j - cnt[i]];
      else
        f[i][j] = pre[j];
      f[i][j] %= mod;
    }
  }
  return f[N][K];
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> cnt[i];
  cout << solve() << '\n';
  return 0;
}
