#include <bits/stdc++.h>
using namespace std;
int64_t exponentiation(int64_t base, int exp) {
  if (exp == 0) return 1;
  if (exp == 1) return base;
  int64_t t = exponentiation(base, exp / 2);
  t = (t * t);
  if (exp % 2 == 0)
    return t;
  else
    return base * t;
}
int64_t dp[3001][3001];
int64_t solve(vector<int>& arr, int n, int k) {
  if (k == 0) return 1;
  if (n == 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  int64_t ans = 0;
  for (int i = 0; i <= min(arr[n - 1], k); i++)
    ans = (ans + solve(arr, n - 1, k - i)) % (int)(1e9 + 7);
  dp[n][k] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int q = 1;
  memset(dp, -1, sizeof(dp));
  while (q--) {
    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    for (auto& item : arr) cin >> item;
    cout << solve(arr, n, k);
  }
  return 0;
}
