#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
unordered_map<string, int> dp;
int find(vector<int>& ar, int idx, int n, int k) {
  if (k == 0) return 1;
  if (idx >= n) return 0;
  string key = to_string(idx) + "_" + to_string(k);
  if (dp.find(key) != dp.end()) return dp[key];
  int cnt = 0;
  for (int i = 0; i <= ar[idx]; i++) {
    cnt = (cnt % mod + find(ar, idx + 1, n, k - i) % mod) % mod;
  }
  return dp[key] = cnt;
}
int main() {
  int n, k;
  cin >> n >> k;
  dp.clear();
  vector<int> ar(n);
  for (int i = 0; i < n; i++) cin >> ar[i];
  int ans = find(ar, 0, n, k) % mod;
  cout << ans;
}
