#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void read(T&... a) {
  ((cin >> a), ...);
}
template <typename... T>
void write(T... a) {
  ((cout << a << "\n"), ...);
}
template <typename... T>
void write_space(T... a) {
  ((cout << a << " "), ...);
}
constexpr int MOD = 1e9 + 7;
constexpr int mxN = 100;
constexpr int mxK = 1e5;
long long dp[mxN][mxK + 1];
void solve() {
  int n, k;
  read(n, k);
  vector<int> a(n);
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  vector<int> s(n);
  s[0] = a[0];
  for (int i = 1; i < n; i++) {
    s[i] = a[i] + s[i - 1];
  }
  for (int i = 0; i <= a[0]; i++) {
    dp[0][i] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      if (j - 1 >= a[i] && dp[i][j - 1] > 0) {
        dp[i][j] = (dp[i][j] + MOD - 1) % MOD;
      }
      if (dp[i][j] >= MOD) {
        dp[i][j] = dp[i][j] % MOD;
      }
    }
  }
  cout << dp[n - 1][k] << endl;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  solve();
  return 0;
}
