#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n = 0) : n(n), d(n + 1) {}
  void add(int i, T x = 1) {
    for (i++; i <= n; i += i & -i) {
      d[i] += x;
      d[i] %= 1000000007;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i & -i) {
      x += d[i];
    }
    return x;
  }
};
int dp[100 + 1][100000 + 1];
int main() {
  int n, K;
  cin >> n >> K;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  BIT<long long> bit(K + 1);
  bit.add(0, 1);
  dp[0][0] = 1;
  for (int i = 0; i < (n); i++) {
    BIT<long long> tbit(K + 1);
    for (int j = 0; j < (K + 1); j++) {
      int l = max(0, j - a[i]);
      int r = j;
      long long sum = bit.sum(r);
      if (l >= 1) sum -= bit.sum(l - 1);
      sum %= 1000000007;
      tbit.add(j, sum);
    }
    swap(bit, tbit);
  }
  long long result = bit.sum(K);
  if (K) {
    result = (result - bit.sum(K - 1) + 1000000007) % 1000000007;
  }
  cout << result << endl;
  return 0;
}
