#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
void solve() {
  int i, j, m, n, k;
  cin >> n >> k;
  int arr[n + 1], dp[n + 1][k + 1];
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (i = 1; i <= k; i++) {
    dp[0][i] = 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      dp[i][j] = 0;
      for (m = max(0, j - arr[i]); m <= j; m++) {
        dp[i][j] += dp[i - 1][m];
        if (dp[i][j] >= mod) dp[i][j] -= mod;
      }
    }
  }
  cout << dp[n][k] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
