#include <bits/stdc++.h>
using namespace std;
int MAX = 1e9 + 7;
int dispatch(int total, vector<int>& criterias) {
  if (total == 0) return 1;
  int n = criterias.size();
  vector<vector<int> > records =
      vector<vector<int> >(total + 1, vector<int>(n + 1, 0));
  records[0][0] = 1;
  for (int candies = 1; candies <= total; candies++)
    records[candies][0] = records[candies - 1][0];
  for (int people = 1; people <= n; people++) records[0][people] = 1;
  for (int people = 1; people <= n; people++) {
    for (int candies = 1; candies <= total; candies++) {
      int low = (candies - criterias[people - 1] - 1 >= 0)
                    ? records[candies - criterias[people - 1] - 1][people - 1]
                    : 0;
      int sum = (records[candies][people - 1] - low) % MAX;
      records[candies][people] = (records[candies - 1][people] + sum) % MAX;
    }
  }
  return (records[total][n] - records[total - 1][n] + MAX * 2) % MAX;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> criterias = vector<int>(n);
  for (int i = 0; i < n; i++) cin >> criterias[i];
  int result = dispatch(k, criterias);
  cout << result << "\n";
  return 0;
}
