#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  long long dp[n + 1][k + 1];
  long long mod = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    dp[i][0] = 1;
  }
  dp[n][0] = 1;
  for (int j = 1; j <= k; j++) dp[0][j] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = 0;
      for (int temp = 0; temp <= a[i - 1] && temp <= j; temp++) {
        dp[i][j] += dp[i - 1][j - temp] % mod;
      }
      dp[i][j] = dp[i][j] % mod;
    }
  }
  cout << dp[n][k] << endl;
}
