#include <bits/stdc++.h>
using namespace std;
struct Benri {
  Benri() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
  }
} benri;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
constexpr long long MOD = 1000000007;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;
ll dp[100][100005];
int main() {
  int N, K;
  cin >> N >> K;
  vi a(N + 1, 0);
  for (int i = 0; i < (int)(N); i++) cin >> a[i + 1];
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < (int)(K + 1); j++) {
      dp[i][j] = dp[i - 1][j];
      if (j - 1 >= 0) dp[i][j] += dp[i][j - 1];
      if (j - 1 - a[i] >= 0) dp[i][j] -= dp[i - 1][j - 1 - a[i]];
      dp[i][j] = (dp[i][j] + MOD) % MOD;
    }
  }
  cout << dp[N][K] << endl;
}
