#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  std::vector<int> v(n);
  for (int i = 1; i <= n; i++) cin >> v[i];
  int dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      for (int t = 0; t <= min(v[i], j); t++)
        dp[i][j] = (dp[i][j] % mod + dp[i - 1][j - t] % mod) % mod;
  }
  cout << dp[n][k] % mod << endl;
}
