#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  const int MOD = 1000000007;
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  vector<vector<int>> dp(N + 1, vector<int>(K + 100));
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < (K + 100); ++j) {
      for (int k = max(0, j - A[i - 1]); k <= j; k++) {
        dp[i][j] += dp[i - 1][k];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[N][K] << endl;
}
