#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 123;
const long long mod = 1e9 + 7;
int n, k;
long long dp[101][N];
long long t[N * 4], f[N], a[N];
void upd(int v, int tl, int tr, int pos, long long val) {
  if (tl > pos || pos > tr) return;
  if (tl == tr) {
    t[v] = val;
    return;
  }
  int tm = (tl + tr) / 2;
  upd(v * 2, tl, tm, pos, val);
  upd(v * 2 + 1, tm + 1, tr, pos, val);
  t[v] = (t[v * 2] + t[v * 2 + 1]) % mod;
}
long long get(int v, int tl, int tr, int l, int r) {
  if (tl > r || l > tr) return 0;
  if (tl >= l && tr <= r) {
    return t[v];
  }
  int tm = (tl + tr) / 2;
  return (get(v * 2, tl, tm, l, r) + get(v * 2 + 1, tm + 1, tr, l, r)) % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  upd(1, 0, k, 0, 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      int l = max(0LL, j - a[i]), r = j;
      dp[i][j] = get(1, 0, k, l, r);
    }
    for (int j = 0; j <= k; j++) {
      upd(1, 0, k, j, dp[i][j]);
    }
  }
  cout << dp[n][k];
}
