#include <bits/stdc++.h>
using namespace std;
int dp[100][100001];
vector<int> ar(100);
int solve(int index, int x) {
  if (dp[index][x] != -1) return dp[index][x];
  long long int ansl = 0;
  if (x == 0) return dp[index][x] = 1;
  if (index == 0) {
    if (ar[0] >= x)
      return dp[index][x] = 1;
    else
      return dp[index][x] = 0;
  }
  for (int i = 0; i <= min(ar[index], x); i++) {
    ansl = (ansl + solve(index - 1, x - i)) % 1000000007;
  }
  return dp[index][x] = ansl % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> ar[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) dp[i][j] = -1;
  }
  cout << solve(n - 1, k) << "\n";
}
