#include <bits/stdc++.h>
using namespace std;
int countToTarget(int end, int sum, int target, vector<int>& children) {
  if (end > children.size()) {
    return 0;
  }
  if (sum == target) {
    return 1;
  }
  int res = 0;
  for (int i = 0; i <= children[end]; ++i) {
    res += countToTarget(end + 1, sum + i, target, children) % 100000007;
  }
  return res;
}
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> children(N);
  for (int i = 0; i < N; ++i) {
    cin >> children[i];
  }
  int end = 0;
  int sum = 0;
  cout << countToTarget(end, sum, K, children);
}
