#include <bits/stdc++.h>
using namespace std;
long long N, K;
long long a[111];
class SegmentTree {
  long long n;
  vector<long long> dat;
  long long query_sub(long long a, long long b, long long i, long long l,
                      long long r) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b)
      return dat[i];
    else {
      long long vl = query_sub(a, b, i * 2 + 1, l, (l + r) / 2);
      long long vr = query_sub(a, b, i * 2 + 2, (l + r) / 2, r);
      return (vl + vr) % 1000000007;
    }
  }

 public:
  SegmentTree(long long n_) {
    n = 1;
    while (n < n_) n *= 2;
    dat = vector<long long>(2 * n - 1, 0);
  }
  void update(long long i, long long x) {
    i += n - 1;
    dat[i] = x;
    while (i > 0) {
      i = (i - 1) / 2;
      dat[i] = (dat[i * 2 + 1] + dat[i * 2 + 2]) % 1000000007;
    }
  }
  long long query(long long a, long long b) { return query_sub(a, b, 0, 0, n); }
  long long at(long long i) { return dat[i + n - 1]; }
};
int main() {
  cin >> N >> K;
  for (long long i = 0; i < N; i++) cin >> a[i];
  SegmentTree dp[2] = {SegmentTree(K + 1), SegmentTree(K + 1)};
  dp[0].update(0, 1);
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j <= K; j++) {
      dp[(i + 1) % 2].update(j, dp[i % 2].query(max(j - a[i], 0LL), j + 1));
    }
  }
  cout << dp[N % 2].at(K) << endl;
  return 0;
}
