#include <bits/stdc++.h>
struct Reader {
  template <class T>
  inline operator T() {
    T w;
    char c, p = 0;
    for (; !isdigit(c = getchar()); c == '-' && (p = 1))
      ;
    for (w = c & 15; isdigit(c = getchar()); w = w * 10 + (c & 15))
      ;
    return p ? -w : w;
  }
} rd;
template <class T>
inline bool smin(T &x, const T &y) {
  return y < x ? x = y, 1 : 0;
}
template <class T>
inline bool smax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
const int P(1e9 + 7);
inline void inc(int &x, int y) {
  if ((x += y) >= P) x -= P;
  if (x < 0) x += P;
}
int n, k, f[100005], g[100005];
int main() {
  n = rd, k = rd;
  f[0] = 1;
  for (int i(0); i <= (k); ++i) g[i] = 1;
  for (int i(1); i <= (n); ++i) {
    int x = rd;
    for (int j(1); j <= (x); ++j) inc(f[j], g[j - 1]);
    for (int j(x + 1); j <= (k); ++j) inc(f[j], g[j - 1] - g[j - x - 1] + P);
    for (int j(1); j <= (k); ++j) inc(g[j] = g[j - 1], f[j]);
  }
  std::cout << f[k];
  return 0;
}
