#include <bits/stdc++.h>
using namespace std;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
constexpr int INF = 100000000;
constexpr long long LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
static inline long long mod(long long x, long long m) {
  long long y = x % m;
  return (y >= 0 ? y : y + m);
}
class BinaryIndexedTree {
  const long long n_;
  vector<long long> vec_;

 public:
  BinaryIndexedTree(long long n) : n_(n), vec_(n + 1, 0) {}
  BinaryIndexedTree(vector<long long> &vec)
      : n_(vec.size()), vec_(vec.size() + 1, 0) {
    for (long long i = 0; i < n_; i++) {
      this->add(i, vec[i]);
    }
  }
  void add(long long idx, long long val) {
    for (long long i = idx + 1; i <= n_; i += (i & -i)) {
      vec_[i] += val;
      vec_[i] %= MOD;
    }
  }
  long long sum(long long idx) {
    long long ret = 0;
    for (long long i = idx + 1; i >= 1; i -= (i & -i)) {
      ret += vec_[i];
      ret %= MOD;
    }
    return ret;
  }
  long long sumRange(long long l, long long r) { return sum(r) - sum(l - 1); }
};
int N, K;
int a[100];
BinaryIndexedTree *bit[101];
void solve() {
  bit[0] = new BinaryIndexedTree(K + 1);
  bit[0]->add(0, 1);
  for (long long i = static_cast<long long>(1);
       i < static_cast<long long>(N + 1); i++) {
    bit[i] = new BinaryIndexedTree(K + 1);
    for (long long j = 0ll; j < static_cast<long long>(K + 1); j++) {
      bit[i]->add(j, bit[i - 1]->sumRange(min(0ll, j - a[i - 1]), j));
    }
  }
  cout << bit[N]->sumRange(K, K) << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> K;
  for (long long i = 0ll; i < static_cast<long long>(N); i++) cin >> a[i];
  solve();
  return 0;
}
