#include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
long long int dp[105][100005];
long long int presum[105][100005];
signed main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v(n + 1);
  for (long long int i = 1; i <= n; i++) cin >> v[i];
  for (long long int i = 1; i <= n; i++) presum[i][0] = 1, dp[i][0] = 1;
  for (long long int i = 0; i <= k; i++) presum[0][i] = 1;
  for (long long int i = 1; i <= n; i++)
    for (long long int j = 1; j <= k; j++) {
      long long int r = j, l = j - v[i] - 1;
      dp[i][j] = (presum[i - 1][r] - (l < 0 ? 0 : presum[i - 1][l])) %
                 (long long int)(1e9 + 7);
      presum[i][j] = (presum[i][j - 1] + dp[i][j]) % (long long int)(1e9 + 7);
    }
  cout << dp[n][k] << "\n";
}
