#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
map<pair<long long, long long>, long long> m;
long long dp(long long i, long long n, long long k, vector<long long>& a) {
  if (i == n) {
    if (k == 0)
      return 1;
    else
      return 0;
  }
  if (k < 0) return 0;
  auto it = m.find({i, k});
  if (it == m.end()) {
    long long sum = 0;
    for (long long j = 0; j <= a[i]; j++)
      sum = (sum + dp(i + 1, n, k - j, a)) % 1000000007;
    return m[{i, k}] = sum;
  } else {
    return it->second;
  }
}
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  ans += dp(0, n, k, a);
  cout << ans << "\n";
  return 0;
}
