#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX_SZ = 2e5 + 9;
const long long INF = 1e18 + 9;
long long N, k;
long long dp[101][100005], arr[102];
void rand_shuff(vector<long long> &arr) {
  random_device rd;
  mt19937 g(rd());
  shuffle(arr.begin(), arr.end(), g);
}
long long solve() {
  for (long long i = (1); i < (N + 1); i++) {
    for (long long j = (0); j < (k + 1); j++) {
      if (i == 1 && j <= arr[i]) {
        dp[i][j] = 1;
        continue;
      }
      long long l = max((long long)0, j - arr[i]);
      long long r = j;
      if (l == 0)
        dp[i][j] = dp[i - 1][r];
      else
        dp[i][j] = (dp[i - 1][r] - dp[i - 1][l - 1]);
    }
    for (long long j = (1); j < (k + 1); j++) {
      dp[i][j] += dp[i][j - 1];
    }
  }
  return (dp[N][k] % MOD - dp[N][k - 1] % MOD) % MOD;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N >> k;
  long long res = 0;
  memset(dp, 0, sizeof(dp));
  for (long long i = (1); i < (N + 1); i++) cin >> arr[i];
  cout << solve() << "\n";
  return 0;
}
