#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = (0); i < (n); ++i) cin >> a[i];
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int x = 0; x <= a[i - 1]; x++) {
        if (j - x >= 0) {
          dp[i][j] += dp[i - 1][j - x];
          dp[i][j] %= mod;
        }
      }
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
