#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> a;
int dp[105][10005];
int m[105];
int rek(int idx, int left) {
  if (idx >= n) return 0;
  if (idx == n - 1) {
    if (left <= a[idx]) return 1;
    return 0;
  }
  if (dp[idx][left] != -1) return dp[idx][left];
  int sol = 0;
  int tops = min(left, a[idx]);
  for (int i = 0; i <= tops; i++) {
    int k = rek(idx + 1, left - i);
    if (k != 0) {
      sol += k;
      sol %= 1000000007;
    }
  }
  return dp[idx][left] = sol;
}
int main() {
  memset(dp, 0, sizeof dp);
  cin >> n >> k;
  a.assign(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      m[i] = a[i];
    else
      m[i] = a[i] + m[i - 1];
  }
  if (m[n - 1] < k) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 0; i <= a[0]; i++) {
    dp[1][k - i] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int x = 0; x <= min(j, a[i]); x++) {
        dp[i + 1][j - x] += dp[i][j];
        dp[i + 1][j - x] %= 1000000007;
      }
    }
  }
  cout << dp[n][0];
}
