#include <bits/stdc++.h>
using namespace std;
int memo[102][100002];
int distribute(int n, int k, vector<int>& children) {
  if (n == 0 && k == 0) {
    return 1;
  }
  if (n == 0) {
    return 0;
  }
  if (memo[n][k] != -1) return memo[n][k];
  int res = 0;
  for (int i = children[n - 1]; i >= 0; --i) {
    res += distribute(n - 1, k - i, children) % 100000007;
  }
  return memo[n][k] = res;
}
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> children(N);
  for (int i = 0; i < N; ++i) {
    cin >> children[i];
  }
  memset(memo, -1, sizeof memo);
  cout << distribute(N, K, children) << endl;
}
