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