#include <bits/stdc++.h>
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &a : v) is >> a;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (const T &t : v) os << t << " ";
  return os << endl;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
  return os << v.first << " " << v.second;
}
double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }
long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int kv;
long long int t, n, x, y, h, k, z, p, q, w, r;
string s, s1, s2;
vector<long long int> v, a;
long long int dp[101][100001], f[101][100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(16);
  ;
  cin >> n >> k;
  v.resize(n);
  cin >> v;
  for (long long i = 0; i < v[0] + 1; i++) dp[0][i] = 1, f[0][i] = i + 1;
  for (int i = 1; i < n; i++) {
    for (long long j = 0; j < k + 1; j++) {
      dp[i][j] = f[i - 1][j] -
                 (j - v[i] - 1 >= 0 ? f[i - 1][j - v[i] - 1] : 0) +
                 (long long int)1000000007;
      dp[i][j] %= (long long int)1000000007;
      f[i][j] = (j > 0 ? f[i][j - 1] : 0) + dp[i][j];
      f[i][j] %= (long long int)1000000007;
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
