#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, k;
long long dp[105][100005];
long long arr[105];
int32_t main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i <= arr[n - 1]; i++) dp[n - 1][i] = 1;
  vector<long long> prefix;
  prefix.clear();
  prefix.push_back(1);
  for (long long j = 1; j <= k; j++)
    prefix.push_back((prefix.back() + dp[n - 1][j]) % MOD);
  for (long long i = n - 2; i >= 0; i--) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = prefix[j] - (j - arr[i] - 1 >= 0 ? prefix[j - arr[i] - 1] : 0);
    }
    prefix.clear();
    prefix.push_back(1);
    for (long long j = 1; j <= k; j++)
      prefix.push_back((prefix.back() + dp[i][j]) % MOD);
  }
  cout << dp[0][k] << "\n";
  return 0;
}
