#include <bits/stdc++.h>
const int MAXN = 105;
const int MAXK = 100005;
const int MOD = 1000000007;
int a[MAXN];
long long f[2][MAXK];
int main() {
  int n, K;
  scanf("%d %d", &n, &K);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int curr = 0, last = 1;
  std::fill(f[curr], f[curr] + a[0] + 1, 1);
  std::fill(f[curr] + a[0] + 1, f[curr] + K + 1, 0);
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= K; j++) {
      f[curr][j] += f[curr][j - 1];
      f[curr][j] >= MOD ? f[curr][j] -= MOD : 0;
    }
    curr ^= 1, last ^= 1;
    for (int j = 0; j <= K; j++)
      f[curr][j] = f[last][j] - (j - a[i] - 1 >= 0 ? f[last][j - a[i] - 1] : 0);
  }
  printf("%lld\n", f[curr][K]);
  return 0;
}
