#include <bits/stdc++.h>
int N, K, A[105];
long long s[105], f[105][100005];
template <typename T>
inline void read(T &var) {
  T x = 0;
  int w = 0;
  char ch = 0;
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  var = w ? -x : x;
}
int main(int argc, char const *argv[]) {
  read(N), read(K);
  f[0][0] = 1;
  for (register int i = 1; i <= N; ++i) read(A[i]);
  for (register int i = 1; i <= N; ++i) {
    s[0] = 0;
    for (register int j = 0; j <= K; ++j) s[j + 1] = s[j] + f[i - 1][j];
    for (register int j = 0; j <= K; ++j)
      (f[i][j] = s[j + 1] - s[std::max(0, j - A[i])]) %= int(1e9 + 7);
  }
  printf("%lld\n", f[N][K]);
  return 0;
}
