#include <bits/stdc++.h>
using namespace std;
template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <typename P, typename Q>
istream& operator>>(istream& is, pair<P, Q>& p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << "(";
  for (auto& i : v) os << i << ",";
  os << ")";
  return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& i : v) is >> i;
  return is;
}
template <typename T>
inline T setmax(T& a, T b) {
  return a = std::max(a, b);
}
template <typename T>
inline T setmin(T& a, T b) {
  return a = std::min(a, b);
}
template <typename T, T MOD>
class SegTree {
 public:
  SegTree(int n_) {
    n = 1;
    while (n < n_) n *= 2;
    v.resize(n * 2 - 1, 0);
  }
  void add(int begin, int end, T x) { return add(begin, end, x, 0, 0, n); }
  T operator[](size_t k) {
    T sum = 0;
    k += n - 1;
    while (0 < k) {
      sum += v[k];
      k = (k - 1) / 2;
    }
    return sum;
  }

 private:
  vector<T> v;
  int n;
  void add(int begin, int end, T x, int k, int l, int r) {
    if (r <= begin || end <= l) {
      return;
    }
    if (begin <= l && r <= end) {
      (v[k] += x) %= MOD;
    } else {
      add(begin, end, x, k * 2 + 1, l, (l + r) / 2);
      add(begin, end, x, k * 2 + 2, (l + r) / 2, r);
    }
    return;
  }
  T sum(int begin, int end, int k, int l, int r) {
    if (r <= begin || end <= l) {
      return 0;
    }
    if (begin <= l && r <= end) {
      return v[k];
    } else {
      auto x = sum(begin, end, k * 2 + 1, l, (l + r) / 2);
      auto y = sum(begin, end, k * 2 + 2, (l + r) / 2, r);
      return (x + y) % MOD;
    }
  }
};
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  constexpr long long int mod = 1e9 + 7;
  int n, k;
  while (cin >> n >> k) {
    vector<int> a(n);
    cin >> a;
    const int K = 1e5 + 5;
    SegTree<long long int, mod> curr(K);
    curr.add(0, 1, 1);
    for (auto& i : a) {
      SegTree<long long int, mod> next(K);
      for (int j = 0; j <= k; ++j) {
        next.add(j, min(k, j + i) + 1, curr[j]);
      }
      curr = next;
    }
    cout << curr[k] << endl;
  }
  return 0;
}
