#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int A[100];
ll dp[102][100002];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  ;
  int K;
  cin >> K;
  ;
  for (int i = (0); i < (102); ++i)
    for (int j = (0); j < (100002); ++j) dp[i][j] = 0LL;
  dp[0][0] = 1LL;
  for (int i = (0); i < (N); ++i) {
    cin >> A[i];
  }
  for (int i = (0); i < (N); ++i) {
    for (int j = (0); j < (K + 1); ++j) {
      if (j - A[i] < 0)
        dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % MOD;
      else
        dp[i + 1][j] =
            (dp[i][j] - dp[i][j - 1 - A[i]] + dp[i + 1][j - 1]) % MOD;
    }
  }
  cout << dp[N][K] % MOD << "\n";
  return 0;
}
