#include <bits/stdc++.h>
using namespace std;
template <typename T>
void cres(vector<T>& Arr, int n) {
  Arr.clear();
  Arr.resize(n);
}
template <typename T>
void cres(vector<vector<T> >& Arr, int row, int col) {
  Arr.clear();
  Arr.resize(row, vector<T>(col));
}
template <typename T>
void read(int x, vector<T>& Arr) {
  for (long long i = x; i < Arr.size(); ++i) cin >> Arr[i];
}
template <typename T>
void read(int x, vector<vector<T> >& Arr) {
  for (long long i = x; i < Arr.size(); ++i) {
    for (long long j = x; j < Arr[i].size(); ++j) cin >> Arr[i][j];
  }
}
template <typename T>
void readg(vector<vector<T> >& Arr, int e) {
  for (long long i = 1; i <= e; ++i) {
    long long x, y;
    cin >> x >> y;
    Arr[x].push_back(y);
    Arr[y].push_back(x);
  }
}
template <typename T>
void read(int x, T Arr[], int n) {
  for (long long i = x; i < n; ++i) cin >> Arr[i];
}
template <typename T>
void write(int x, vector<T>& Arr) {
  for (long long i = x; i < Arr.size(); ++i) cout << Arr[i] << " ";
}
template <typename T>
void write(int x, vector<vector<T> >& Arr) {
  for (long long i = x; i < Arr.size(); ++i) {
    for (long long j = x; j < Arr[i].size(); ++j) cout << Arr[i][j] << " ";
    cout << "\n";
  }
}
template <typename T>
void write(int x, T Arr[], int n) {
  for (long long i = x; i < n; ++i) cout << Arr[i] << " ";
}
template <typename T>
void write(set<T>& s) {
  for (auto i : s) cout << i << " ";
}
template <typename T0, typename T1>
void write(map<T0, T1>& m) {
  for (auto i : m) cout << i.first << " " << i.second << "\n";
}
const long long maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
long long n, k;
vector<long long> a;
long long dp[110][maxn];
long long prefsum[110][maxn];
int main() {
  cin >> n >> k;
  cres(a, n);
  read(0, a);
  memset(dp, 0, sizeof dp);
  memset(prefsum, 0, sizeof prefsum);
  dp[n - 1][0] = 1;
  prefsum[n - 1][0] = 1;
  for (long long i = 1; i <= k; i++) {
    if (i <= a[n - 1]) {
      dp[n - 1][i] = 1;
    } else {
      dp[n - 1][i] = 0;
    }
    prefsum[n - 1][i] =
        (dp[n - 1][i] % mod + prefsum[n - 1][i - 1] % mod) % mod;
  }
  if (n == 1) {
    cout << prefsum[0][k];
    return 0;
  }
  for (long long i = n - 2; i >= 0; i--) {
    for (long long j = 0; j <= k; j++) {
      if (j - a[i] - 1 >= 0) {
        dp[i][j] = (prefsum[i + 1][j] % mod -
                    prefsum[i + 1][j - a[i] - 1] % mod + mod) %
                   mod;
      } else {
        dp[i][j] = prefsum[i + 1][j] % mod;
      }
      if (j - 1 >= 0)
        prefsum[i][j] = (dp[i][j] % mod + prefsum[i][j - 1] % mod) % mod;
      else
        prefsum[i][j] = dp[i][j] % mod;
    }
  }
  cout << dp[0][k] % mod << "\n";
  return 0;
}
