#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T& a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T& a, T b) {
  if (a > b) a = b;
}
const long long INF = 1LL << 60;
template <class V>
struct BIT {
  BIT() {}
  int NV;
  vector<V> bit;
  BIT(int n) { init(n); }
  void init(int n) {
    NV = 1;
    while (NV < n) NV *= 2;
    bit.resize(NV);
    clear();
  }
  V operator[](int e) {
    V s = 0;
    e++;
    while (e) s += bit[e - 1], e -= e & -e;
    return s;
  }
  void add(int e, V v) {
    e++;
    while (e <= NV) bit[e - 1] += v, e += e & -e;
  }
  int lower_bound(V val) {
    V tv = 0;
    int i, ent = 0;
    for (i = NV - 1; i >= 0; i--)
      if (tv + bit[ent + (1 << i) - 1] <= val)
        tv += bit[ent + (1 << i) - 1], ent += (1 << i);
    return ent;
  }
  V get(int L, int R) {
    assert(0 <= L);
    assert(R <= NV);
    assert(L <= R);
    V res = 0;
    if (R) res += operator[](R - 1);
    if (L) res -= operator[](L - 1);
    return res;
  }
  void clear() {
    for (int i = 0; i < NV; ++i) bit[i] = 0;
  }
};
int N, K;
int a[110];
BIT<long long int> dp[110];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i <= N; ++i) dp[i].init(K + 1);
  dp[0].add(K, 1);
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      dp[i].add(j, dp[i - 1].get(j, min(K, j + a[i - 1]) + 1));
    }
  }
  cout << dp[N].get(0, 1) % 1000000007 << endl;
  return 0;
}
