#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}
bool prime(long long x) {
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return x != 1;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long kai(long long x, long long y) {
  long long res = 1;
  for (long long i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= (long long)(1e9 + 7);
  }
  return res;
}
long long mod_pow(long long x, long long y, long long m) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}
long long comb(long long x, long long y) {
  if (y > x) return 0;
  return kai(x, y) *
         mod_pow(kai(y, y), (long long)(1e9 + 7) - 2, (long long)(1e9 + 7)) %
         (long long)(1e9 + 7);
}
long long get_rand(long long MIN, long long MAX) {
  std::random_device rnd;
  std::mt19937 mt32(rnd());
  std::uniform_int_distribution<long long> engine(MIN, MAX);
  return engine(mt32);
}
struct Segtree {
  vector<long long> dat, lazy;
  long long size = 1;
  void init(long long x) {
    while (size < x) size *= 2;
    dat.resize(size * 2 - 1, 0);
    lazy.resize(size * 2 - 1, 0);
  }
  void eval(long long k, long long l, long long r) {
    dat[k] += lazy[k];
    dat[k] %= (long long)(1e9 + 7);
    if (r - l > 1) {
      lazy[k * 2 + 1] += lazy[k];
      lazy[k * 2 + 2] += lazy[k];
    }
    lazy[k] = 0;
  }
  void update(long long a, long long b, long long x, long long k = 0,
              long long l = 0, long long r = -1) {
    if (r == -1) r = size;
    eval(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] += x;
      lazy[k] %= (long long)(1e9 + 7);
      eval(k, l, r);
      return;
    }
    update(a, b, x, k * 2 + 1, l, (l + r) / 2);
    update(a, b, x, k * 2 + 2, (l + r) / 2, r);
  }
  long long query(long long a, long long k = 0, long long l = 0,
                  long long r = -1) {
    if (r == -1) r = size;
    eval(k, l, r);
    if (r - l == 1) return dat[k];
    if (a < (l + r) / 2) {
      return query(a, k * 2 + 1, l, (l + r) / 2);
    }
    return query(a, k * 2 + 2, (l + r) / 2, r);
  }
};
long long n, k, a[105];
signed main() {
  cin >> n >> k;
  Segtree DP[105];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n + 1; i++) DP[i].init(114514);
  DP[0].update(0, 1, 1);
  for (long long i = 0; i < n; i++) {
    for (long long j = k; j >= 0; j--) {
      long long p = DP[i].query(j);
      long long r = min(k, j + a[i]);
      DP[i + 1].update(j, r + 1, p);
    }
  }
  cout << DP[n].query(k) << endl;
}
