#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long rec(vector<int> a, int i, int k) {
  if (k == 0) return 1;
  if (i == a.size()) {
    return 0;
  }
  if (dp[i][k] != -1) return dp[i][k];
  long long ret = 0;
  for (int curr = 0; curr <= a[i]; curr++) {
    if (k >= curr) {
      ret = ret + rec(a, i + 1, k - curr);
      if (ret > (int)(1e9 + 7)) ret -= (int)(1e9 + 7);
    }
  }
  return dp[i][k] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ret = rec(a, 0, k);
  cout << ret << endl;
}
