#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using i64 = int64_t;
template <class T, class U>
void init_n(vector<T>& v, size_t n, U x) {
  v = vector<T>(n, x);
}
template <class T>
void init_n(vector<T>& v, size_t n) {
  init_n(v, n, T());
}
template <class T>
void read_n(vector<T>& v, size_t n, size_t o = 0) {
  v = vector<T>(n + o);
  for (lli i = o; i < n + o; ++i) cin >> v[i];
}
template <class T>
void read_n(T a[], size_t n, size_t o = 0) {
  for (lli i = o; i < n + o; ++i) cin >> a[i];
}
template <class T>
T gabs(const T& x) {
  return max(x, -x);
}
const i64 mod = 1e9 + 7;
i64 n, k, dp[101][100001];
vector<i64> a;
i64 dfs(i64 i, i64 m) {
  if (m == 0) return 1;
  if (i <= 0 || m < 0) return 0;
  if (dp[i][m] >= 0) return dp[i][m];
  return dp[i][m] =
             (dfs(i - 1, m) + dfs(i, m - 1) - dfs(i - 1, m - a[i] - 1)) % mod;
}
int main() {
  cin >> n >> k;
  read_n(a, n, 1);
  fill(&dp[0][0], &dp[100][100000] + 1, -1);
  cout << dfs(n, k) << '\n';
  return 0;
}
