#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;
int tr[105][N];
void add(int, int, int);
int ask(int, int);
int a[105];
int main() {
  int n, K;
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  if (K == 0) {
    printf("%d", 1);
    return 0;
  }
  tr[0][0] = 1;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += a[i];
    tr[i][0] = tr[i - 1][0];
    for (int j = 1; j <= sum && j <= K; j++) {
      add(i, j,
          (1LL * mod + ask(i - 1, j) - ask(i - 1, max(0, j - a[i] - 1))) % mod);
      if (j <= a[i]) add(i, j, 1);
    }
  }
  printf("%d\n", (int)((1LL * ask(n, K) - ask(n, max(0, K - 1))) % mod));
}
int ask(int id, int i) {
  int re = 0;
  while (i) {
    re += tr[id][i];
    re %= mod;
    i -= i & -i;
  }
  return re;
}
void add(int id, int i, int k) {
  while (i < N) {
    tr[id][i] += k;
    tr[id][i] %= mod;
    i += i & -i;
  }
}
