#include <bits/stdc++.h>
using namespace std;
int dp[101][100010];
int util(vector<int>& vec, int idx, int candy, int n, int k) {
  if (dp[idx][candy] > -1) return dp[idx][candy];
  long long ans = 0;
  for (int i = 0; i <= vec[idx - 1]; i++) {
    if (i <= candy)
      ans = (ans + util(vec, idx - 1, candy - i, n, k)) % 1000000007;
  }
  return dp[idx][candy] = ans % 1000000007;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    vec.push_back(c);
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) dp[i][j] = -1;
  }
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int j = 0; j <= k; j++) dp[0][j] = 0;
  dp[0][0] = 1;
  int ans = util(vec, n, k, n, k);
  cout << ans << endl;
  return 0;
}
