#include <bits/stdc++.h>
using namespace std;
template <typename T>
void max_self(T& a, T b) {
  a = max(a, b);
}
const int nax = 305;
double p[nax][nax][nax], ex[nax][nax][nax];
int main() {
  int mod = 1e9 + 7;
  int n, k;
  cin >> n >> k;
  vector<int> dp(k + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    int upto;
    cin >> upto;
    vector<int> diff(k + 1);
    for (int j = k - 1; j >= 0; j--) {
      int tmp = dp[j];
      int L = j + 1;
      int R = j + upto;
      if (L <= R) {
        diff[L] += tmp;
        diff[L] %= mod;
        if (R + 1 <= k) {
          diff[R + 1] -= tmp;
          if (diff[R + 1] < mod) {
            diff[R + 1] += mod;
          }
        }
      }
    }
    int prefix = 0;
    for (int i = 0; i <= k; i++) {
      prefix += diff[i];
      prefix %= mod;
      dp[i] += prefix;
      dp[i] %= mod;
    }
  }
  cout << dp[k] << endl;
}
