#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> const &v) {
  return os << '(' << v.first << ", " << v.second << ')';
}
int n, k;
int a[103], sum[103];
int f[103][100003];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i <= k; ++i) sum[i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      int mn = min(j, a[i]);
      f[i][j] = (sum[j] - (j - mn == 0 ? 0 : sum[j - mn - 1])) % 1000000007;
      if (f[i][j] < 0) f[i][j] += 1000000007;
    }
    sum[0] = f[i][0];
    for (int j = 1; j <= k; ++j) sum[j] = (sum[j - 1] + f[i][j]) % 1000000007;
  }
  printf("%d\n", f[n][k]);
  return 0;
}
