#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  if (0 == 0) return;
  cerr << *it << " = " << a << " ";
  err(++it, args...);
}
long long A[100];
long long dp[100001][100];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> A[i];
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    dp[i][0] = (A[0] >= i ? 1 : 0);
    dp[i][0] += dp[i - 1][0];
  }
  for (int i = 0; i < n; i++) dp[0][i] = 1;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 1; j <= k; j++) {
      dp[j][i] =
          (j > A[i] ? ((dp[j][i - 1] - dp[j - A[i] - 1][i - 1] + 1000000007) %
                       1000000007)
                    : ((dp[j][i - 1]) % 1000000007));
      dp[j][i] =
          (dp[j][i] % 1000000007 + dp[j - 1][i] % 1000000007) % 1000000007;
    }
  }
  cout << dp[k][n - 1] - dp[k - 1][n - 1] << endl;
  return 0;
}
