#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void solve() {
  int N, K, a;
  cin >> N >> K;
  vector<int> dp(K + 1);
  dp[0] = 1;
  for (int i = 0; i < N; i++) {
    cin >> a;
    vector<int> nx = dp;
    for (int j = 1; j <= K; j++) {
      if (j > a) {
        (nx[j] += nx[j - 1] - dp[j - a - 1]) %= MOD;
      } else {
        (nx[j] += nx[j - 1]) %= MOD;
      }
    }
    dp = nx;
  }
  cout << dp[K] << endl;
}
int main() {
  solve();
  return 0;
}
