#include <bits/stdc++.h>
using namespace std;
long long mod(long long first, long long second) { return first % second; }
long long maxn = 1000000007;
long long m, n, row, col, k;
long long ara[105];
long long dp[105][100006];
long long pref[105][100006];
void solve() {
  cin >> n >> k;
  for (long long w = 0; w < n; w++) cin >> ara[w];
  for (long long w = 0; w <= k; w++) {
    dp[0][w] = (w >= 0 && w <= ara[0]) ? 1 : 0;
    pref[0][w] =
        (w == 0) ? mod(dp[0][w], maxn) : mod(pref[0][w - 1] + dp[0][w], maxn);
  }
  for (long long j = 0; j <= k; j++) {
    for (long long i = 1; i < n; i++) {
      long long first = min(ara[i], j);
      long long second = j - first - 1;
      if (second >= 0)
        dp[i][j] = mod(pref[i - 1][j] - pref[i - 1][second], maxn);
      else
        dp[i][j] = mod(pref[i - 1][j], maxn);
      if (j != 0)
        pref[i][j] = mod(pref[i][j - 1] + dp[i][j], maxn);
      else
        pref[i][j] = mod(dp[i][j], maxn);
    }
  }
  cout << dp[n - 1][k] << '\n';
}
void test() {
  long long t;
  t = 1;
  for (long long test = 1; test <= t; test++) {
    solve();
  }
}
int main() {
  test();
  return 0;
}
