#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
  for (auto &x : a) in >> x;
  return in;
}
template <typename T>
inline ostream &operator<<(ostream &out, vector<T> &a) {
  for (auto &x : a) out << x << " ";
  return out;
}
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
int n, k;
vector<long long> a;
vector<vector<long long> > dp;
vector<vector<bool> > visited;
long long solve(int index, int left) {
  if (index < 0 && left == 0) return 1;
  if (index < 0 && left != 0) return 0;
  if (index >= 0 && left == 0) return dp[index][left] = 1;
  if (visited[index][left]) return dp[index][left];
  visited[index][left] = true;
  for (int i = 0; i <= a[index]; i++) {
    if (left >= i) {
      dp[index][left] += solve(index - 1, left - i);
      dp[index][left] %= 100000007;
    }
  }
  return dp[index][left];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    cin >> n >> k;
    a.resize(n);
    cin >> a;
    dp.resize(n, vector<long long>(k + 1, 0));
    visited.resize(n, vector<bool>(k + 1, 0));
    cout << solve(n - 1, k);
  }
}
