#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN];
int dp[101][MAXN];
int n, k;
const int MOD = 1e9 + 7;
inline long long int mod_ans(long long int a, int val) {
  if (a >= val) return a % val;
  return a;
}
int find_ans(int N = 0, int K = k) {
  if (N == n) {
    if (K == 0) return 1;
    return 0;
  } else if (dp[N][K] != -1) {
    return dp[N][K];
  } else {
    int max_limit = min(K, a[N]);
    long long int ans = 0;
    for (int i = 0; i <= max_limit; ++i) {
      ans += find_ans(N + 1, K - i);
      ans = mod_ans(ans, MOD);
    }
    dp[N][K] = ans;
    return ans;
  }
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = -1;
    }
  }
  cout << find_ans() << "\n";
  return 0;
}
