#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
const long long INF = 1LL << 60;
const long long MAXN = (long long)1e5 + 10;
const long long DIV = (long long)1e9 + 7;
long long dp[MAXN];
vector<int> A;
void Update(int i) {
  long long dp1[MAXN];
  dp1[0] = dp[0];
  for (int j = 0; j < (int)(MAXN - 1); j++) {
    dp1[j + 1] = dp1[j] + dp[j + 1];
    if (j - A[i] >= 0) dp1[j + 1] -= dp[j - A[i]];
    dp1[j + 1] = dp1[j + 1] % DIV;
  }
  swap(dp, dp1);
  return;
}
int main(void) {
  long long N, K;
  cin >> N >> K;
  A.resize(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 0; i < (int)(N); i++) Update(i);
  cout << dp[K] << endl;
  return 0;
}
