#include <bits/stdc++.h>
using namespace std;
long long M = 1000000007;
vector<vector<long long>> dp;
vector<long long> a;
long long solve(int i, int r) {
  if (r < 0) return 0;
  if (dp[i][r] != -1) return dp[i][r];
  if (i == 0) {
    if (r == 0)
      return 1;
    else
      return 0;
  }
  dp[i][r] = 0;
  for (int k = 0; k <= a[i - 1]; ++k) {
    dp[i][r] += solve(i - 1, r - k);
    dp[i][r] %= M;
  }
  return dp[i][r];
}
int main(int argc, char const *argv[]) {
  long long n, k;
  cin >> n >> k;
  a = vector<long long>(n);
  dp = vector<vector<long long>>(n + 1, vector<long long>(k + 1, -1));
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << solve(n, k) << endl;
  return 0;
}
