#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void join(const vector<string>& v, char c, string& s) {
  s.clear();
  for (vector<string>::const_iterator p = v.begin(); p != v.end(); ++p) {
    s += *p;
    if (p != v.end() - 1) s += c;
  }
}
long long n;
vector<long long> cap(100, 0);
vector<vector<long long> > dp(100, vector<long long>(10e5, -1));
long long distribute(long long start, long long k) {
  if (bool(start < n)) {
  } else {
    return (k == 0 ? 1 : 0);
  }
  if (bool(dp[start][k] == -1)) {
  } else {
    return dp[start][k];
  }
  long long res = 0;
  for (long long i = 0; i < cap[start] + 1; i++) {
    res = (res + distribute(start + 1, k - i)) % 1000000007;
  }
  dp[start][k] = res % 1000000007;
  return dp[start][k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    long long ai;
    cin >> ai;
    cap[i] = ai;
  }
  cout << distribute(0, k) << '\n';
  return 0;
}
