#include <bits/stdc++.h>
using namespace std;
const int mod = pow(10, 9) + 7;
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1);
  dp[0] = 1;
  while (n--) {
    int a;
    cin >> a;
    vector<long long> ndp(k + 1, 0);
    for (int i = 0; i < a; i++) {
      ndp[i] = (i == 0) ? dp[i] : ndp[i - 1] + dp[i];
      if (ndp[i] > mod) ndp[i] -= mod;
    }
    for (int i = a; i <= k; i++) {
      ndp[i] = ndp[i - 1] - dp[i - a] + dp[i];
      if (ndp[i] > mod) ndp[i] -= mod;
    }
    dp = ndp;
  }
  cout << dp[k] << endl;
}
