#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;
const ld EPS = 1e-9;
inline int cmp(ld first, ld second = 0, ld tol = EPS) {
  return (first <= second + tol) ? (first + tol < second) ? -1 : 0 : 1;
}
const int MOD = 1e9 + 7;
inline int mod(ll first, int m = MOD) { return (int)(((first % m) + m) % m); }
const int N = 110, K = 1e5 + 10;
int n, k;
int a[N];
int pd[N][K];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int j = 0; j <= a[1]; j++) pd[1][j] = 1;
  for (int i = 2; i <= n; i++) {
    pd[i][0] = 1;
    int acu = 1;
    for (int j = 1; j <= k and acu; j++) {
      acu = mod(acu + pd[i - 1][j]);
      if ((j - a[i] - 1) >= 0) acu = mod(acu - pd[i - 1][j - a[i] - 1]);
      pd[i][j] = acu;
    }
  }
  printf("%d\n", pd[n][k]);
  return 0;
}
