#include <bits/stdc++.h>
using namespace std;
int dp[100001];
vector<int> ar(100);
void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
void add(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
long long int solve_bottom_up(int n, int k) {
  dp[0] = 1;
  for (int child = 0; child < n; child++) {
    vector<int> pf(k + 1, 0);
    for (int used = k; used >= 0; used--) {
      int l = used + 1;
      int r = used + min(ar[child], k - used);
      add(pf[l], dp[used]);
      if (r + 1 <= k) sub(pf[r + 1], dp[used]);
    }
    int prf_sum = 0;
    for (int i = 0; i <= k; i++) {
      add(prf_sum, pf[i]);
      add(dp[i], prf_sum);
    }
  }
  return dp[k];
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> ar[i];
  cout << solve_bottom_up(n, k) << "\n";
}
