#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> adj(105);
long long dp[103][100005];
long long candy_dist(int ind, int k) {
  if (k == 0) return 1;
  if (k < 0) return 0;
  if (ind > n) return 0;
  if (dp[ind][k] == -1) {
    long long ans = 0;
    for (int i = 0; i <= adj[ind]; i++) {
      ans = ((ans) % 1000000007 + (candy_dist(ind + 1, k - i)) % 1000000007) %
            1000000007;
    }
    dp[ind][k] = ans;
  }
  return dp[ind][k];
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  int k;
  cin >> k;
  for (int i = 1; i <= n; i++) cin >> adj[i];
  long long ans = candy_dist(1, k);
  cout << ans;
}
