#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MOD = 1000000007LL;
const int MAX_N = 105;
const int MAX_K = 100005;
int n, k;
int a[MAX_N];
long long dp[MAX_N][4 * MAX_K];
void addOnRange(int tI, int i, int l, int r, int lx, int rx, long long val) {
  if (l == lx && r == rx)
    dp[tI][i] = (dp[tI][i] + val) % MOD;
  else {
    int mid = (l + r) / 2;
    if (lx <= mid) addOnRange(tI, 2 * i + 1, l, mid, lx, min(rx, mid), val);
    if (rx > mid)
      addOnRange(tI, 2 * i + 2, mid + 1, r, max(lx, mid + 1), rx, val);
  }
}
long long getValue(int tI, int i, int l, int r, int pos) {
  if (l == r)
    return dp[tI][i];
  else {
    int mid = (l + r) / 2;
    if (pos <= mid)
      return dp[tI][i] + getValue(tI, 2 * i + 1, l, mid, pos);
    else
      return dp[tI][i] + getValue(tI, 2 * i + 2, mid + 1, r, pos);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  addOnRange(0, 0, 0, k, 0, 0, 1);
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= k; j++) {
      long long currVal = getValue(i, 0, 0, k, j) % MOD;
      addOnRange(i + 1, 0, 0, k, j, min(k, j + a[i]), currVal);
    }
  cout << (getValue(n, 0, 0, k, k) % MOD) << endl;
}
