#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
struct edge {
  int to;
};
using graph = vector<vector<edge>>;
const int MOD = 1000000007;
ll add(ll a, ll b) { return (a + b) % MOD; }
const int MAXN = 100;
const int MAXK = 100000;
ll dp[MAXK + 5];
ll psum[MAXK + 5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vi a(n);
  for (auto& i : a) cin >> i;
  psum[0] = 1;
  auto sum = [&](int i, int j) { return i ? psum[j] - psum[i - 1] : psum[j]; };
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (k + 1); ++j) {
      dp[j] = sum(j - min(j, a[i]), j);
    }
    for (auto j = (0); j < (k + 1); ++j)
      psum[j] = add((j ? psum[j - 1] : 0LL), dp[j]);
  }
  cout << psum[k] << '\n';
}
