#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline int chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline int chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1 << 30;
const ll LINF = 1LL << 58;
const int mod = 1000000007;
ll dp[110][101010];
int main() {
  int n, k;
  cin >> n >> k;
  int A[110];
  for (int i = 0; i < n; i++) cin >> A[i];
  int a = 0;
  vector<ll> S(k + 1, 0LL);
  dp[0][0] = 1LL;
  for (int i = 0; i < n; i++) {
    a += A[i];
    for (int j = 0; j <= min(k, a); j++) {
      S[j + 1] = (S[j] + dp[i][j]) % mod;
    }
    for (int j = 0; j <= min(k, a); j++) {
      dp[i + 1][j] = S[j + 1] - S[max(0, j - A[i])];
      dp[i + 1][j] %= mod;
      if (dp[i + 1][j] < 0) dp[i + 1][j] += mod;
    }
  }
  cout << dp[n][k] << endl;
}
