#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int dp[105][10005];
int calculate(int pos, int left, int n, int a[]) {
  if (pos == n) {
    if (left == 0)
      return 1;
    else
      return 0;
  }
  if (left == 0) return 1;
  if (dp[pos][left] != -1) return dp[pos][left];
  int answer = 0;
  for (int i = 0; i <= a[pos]; i++) {
    if (i > left) break;
    answer = (answer + calculate(pos + 1, left - i, n, a)) % mod;
  }
  return dp[pos][left] = answer;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << calculate(0, k, n, a) << endl;
  return 0;
}
