#include <bits/stdc++.h>
using namespace std;
long long q, d, dp[100][100005], a[555555], b[555555], k, l, m, n, o, p;
map<long long, long long> mp;
vector<long long> adj[555555];
const long long mod = 1e9 + 7;
long long mem(long long i, long long sum) {
  if (sum < 0) return 0;
  if (i == n) return !sum;
  long long &r = dp[i][sum];
  if (r != -1) return r;
  r = mem(i + 1, sum) % mod + mem(i, sum - 1) % mod -
      mem(i + 1, sum - a[i] - 1) % mod;
  r %= mod;
  return r;
}
void solve() {
  memset(dp, -1, sizeof dp);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << mem(0, k);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  q = 1;
  while (q--) {
    solve();
  }
}
