#include <bits/stdc++.h>
using namespace std;
inline long long get(vector<long long> &nums, long long low, long long up) {
  if (low <= 0) return nums[up];
  return nums[up] - nums[low - 1];
}
int main(int argc, char const *argv[]) {
  const long long MOD = (long long)1e9 + 7;
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (long long i = 0; i < n; ++i) cin >> a[i + 1];
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  for (long long i = 0; i <= n; ++i) dp[i][0] = 1;
  for (long long j = 0; j <= k; ++j) dp[0][j] = 1;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= k; ++j) {
      long long low = j - a[i], up = j;
      dp[i][j] = get(dp[i - 1], low, up);
      dp[i][j] %= MOD;
    }
    if (i != n)
      for (long long j = 1; j <= k; ++j)
        dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
  }
  cout << dp[n][k] << endl;
  return 0;
}
