#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (auto i = 1; i <= n; ++i) cin >> a[i];
  int dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));
  for (auto i = 0; i <= a[1]; ++i) {
    dp[1][i] = 1;
  }
  for (auto i = 2; i <= n; ++i) {
    dp[i][0] = 1;
    for (auto j = 1; j <= k; j++) {
      for (auto t = 0; t <= a[i] and t <= j; t++) {
        dp[i][j] = ((dp[i][j] % M) + (dp[i - 1][j - t] % M)) % M;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
