#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Cin(T& x) {
  char c;
  T sign = 1;
  x = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sign;
}
template <typename T>
inline void Out(T x) {
  if (x > 9) Out(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void Cout(T x, char c) {
  if (x < 0) putchar('-');
  x = abs(x);
  Out(x);
  putchar(c);
}
template <typename T, typename... Args>
inline void Cin(T& a, Args&... args) {
  Cin(a);
  Cin(args...);
}
template <typename T, typename... Args>
inline void Cout(T a, char c, Args... args) {
  Cout(a, c);
  Cout(args...);
}
const int N = 107;
const int M = 1e5 + 7;
const int mod = 1e9 + 7;
int n, k, a[N];
long long s[N], f[N][M];
void Enter() {
  Cin(n, k);
  for (int i = 1, _b = n; i <= _b; ++i) Cin(a[i]);
}
long long Sum(int l, int r) {
  if (l > r) return 0;
  r = min(r, k);
  return s[r] - s[l - 1];
}
void Solve() {
  f[0][k] = s[k] = 1;
  for (int i = 1, _b = n; i <= _b; ++i) {
    for (int j = 0, _b = k; j <= _b; ++j) f[i][j] += Sum(j, a[i] + j) % mod;
    s[0] = f[i][0];
    for (int j = 1, _b = k; j <= _b; ++j) s[j] = (f[i][j] + s[j - 1]) % mod;
  }
  cout << f[n][0] % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Enter();
  Solve();
  return 0;
}
