#include <bits/stdc++.h>
using namespace std;
template <class T>
T inp() {
  T it;
  cin >> it;
  return it;
}
long long N, K;
vector<long long> li;
vector<long long> dp;
vector<long long> dp2;
int input() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) li.push_back(inp<long long>());
}
int main() {
  input();
  for (int i = 0; i < K + 1; i++) dp.push_back(0);
  for (int i = 0; i < K + 1; i++) dp2.push_back(0);
  dp[0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < K + 1; j++) dp2[j] = 0;
    for (int j = 0; j < K + 1; j++) {
      dp2[j] = dp[j];
      if (j > 0) dp2[j] += dp2[j - 1];
      if (j - li[i] > 0) dp2[j] += -dp[j - li[i] - 1] + (1000000007 * 9);
    }
    for (int j = 0; j < K + 1; j++) dp[j] = dp2[j] % (1000000007);
  }
  cout << dp[K] << endl;
}
