#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using ll = long long;
using ff = long double;
using pii = pair<int, int>;
void err(istream_iterator<string> it) {
  it->empty();
  cerr << " (Line : " << 36 << ")" << '\n';
}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << fixed << setprecision(15) << " [ " << *it << " : " << a << " ] "
       << ' ';
  err(++it, args...);
}
const int MOD = (int)1e9 + 7;
const int K = (int)1e5 + 10, N = 103;
int n, k;
int ar[N];
int dp[K];
int seg[4 * K];
int add(int a, int b) { return ((a % MOD) + (b % MOD)) % MOD; }
void create(int l, int r, int first) {
  if (l == r) {
    seg[first] = dp[l];
    return;
  }
  int mid = (l + r) / 2;
  create(l, mid, first + first + 1);
  create(mid + 1, r, first + first + 2);
  seg[first] = add(seg[first + first + 1], seg[first + first + 2]);
}
int query(int l, int r, int ql, int qr, int first) {
  if (l > qr || r < ql) return 0;
  if (l >= ql && r <= qr) return seg[first];
  int mid = (l + r) / 2;
  return add(query(l, mid, ql, qr, first + first + 1),
             query(mid + 1, r, ql, qr, first + first + 2));
}
void solve() {
  for (int i = 1; i <= k; ++i) dp[i] = 0;
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    create(0, k, 0);
    for (int j = k; j >= 0; --j) {
      dp[j] = query(0, k, max(0, j - ar[i]), j, 0);
    }
  }
  cout << dp[k] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> ar[i];
  solve();
  return EXIT_SUCCESS;
}
