#include <bits/stdc++.h>
long long dp[100001][101], a[101];
using namespace std;
long long f(int i, int j) {
  if (i < 0) return 0;
  if (j <= 0) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  long long val = 0;
  for (int p = 0; p <= a[j]; p++) val = (val + f(i - p, j - 1)) % 1000000007;
  dp[i][j] = val;
  return dp[i][j];
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, -1, sizeof(long long) * 100001 * 101);
  for (int i = 0; i <= k; i++) {
    if (i <= a[1])
      dp[i][1] = 1;
    else
      dp[i][1] = 0;
  }
  int val = f(k, n);
  cout << val << endl;
  return 0;
}
