#include <bits/stdc++.h>
using namespace std;
void add(long long &a, long long b) {
  a += b;
  if (a >= 1e9 + 7) a -= 1e9 + 7;
}
void sub(long long &a, long long b) {
  a -= b;
  if (a >= 1e9 + 7)
    a -= 1e9 + 7;
  else if (a < 0)
    a += 1e9 + 7;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1, 0);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    int maxa;
    cin >> maxa;
    vector<long long> fake(k + 1, 0);
    for (int j = k; j >= 0; j--) {
      long long temp = dp[j];
      int l = j + 1;
      int r = j + maxa;
      if (l <= k) fake[l] += temp;
      if (r < k) fake[r + 1] -= temp;
    }
    for (int j = 1; j <= k; j++) {
      add(fake[j], fake[j - 1]);
      add(dp[j], fake[j]);
    }
  }
  cout << dp[k] << endl;
  return 0;
}
