#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const double EPS = 1e-6;
const int MAX_N = 105;
const int MAX_K = 1e5 + 5;
class SegmentTree {
 public:
  int N;
  vector<int> sum, delta;
  SegmentTree() {}
  SegmentTree(int N) {
    this->N = N;
    sum = vector<int>(4 * N + 1);
    delta = vector<int>(4 * N + 1);
  }
  void update(int l, int r, int val) { update(1, 0, N - 1, l, r, val); }
  int query(int l, int r) { return query(1, 0, N - 1, l, r); }
  void init(int i, int lo, int hi) {
    if (lo == hi) return;
    int m = (lo + hi) / 2;
    init(2 * i, lo, m);
    init(2 * i + 1, m + 1, hi);
  }
  void push(int i) {
    delta[2 * i] = (delta[2 * i] + delta[i]) % MOD;
    delta[2 * i + 1] = (delta[2 * i + 1] + delta[i]) % MOD;
    delta[i] = 0;
  }
  void pull(int i) {
    sum[i] =
        (sum[2 * i] + delta[2 * i] + sum[2 * i + 1] + delta[2 * i + 1]) % MOD;
  }
  void update(int i, int lo, int hi, int l, int r, int val) {
    if (r < lo || hi < l) return;
    if (l <= lo && hi <= r) {
      delta[i] = (delta[i] + val) % MOD;
      return;
    }
    push(i);
    int m = (lo + hi) / 2;
    update(2 * i, lo, m, l, r, val);
    update(2 * i + 1, m + 1, hi, l, r, val);
    pull(i);
  }
  int query(int i, int lo, int hi, int l, int r) {
    if (r < lo || hi < l) return 0;
    if (l <= lo && hi <= r) {
      return (sum[i] + delta[i]) % MOD;
    }
    push(i);
    int m = (lo + hi) / 2;
    int sumLeft = query(2 * i, lo, m, l, r);
    int sumRight = query(2 * i + 1, m + 1, hi, l, r);
    pull(i);
    return (sumLeft + sumRight) % MOD;
  }
};
int N, K;
int a[MAX_N];
SegmentTree st(MAX_K);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  st.update(0, 0, 1);
  for (int i = 0; i < N; ++i) {
    for (int j = K; j >= 1; --j) {
      st.update(j, j, st.query(max(0, j - a[i]), j - 1));
    }
  }
  cout << st.query(K, K) << '\n';
  return 0;
}
