#include <bits/stdc++.h>
using namespace std;
int n, k, a[111], md = 1e9 + 7;
int dp[111][100005];
int solve(int i, int l) {
  if (i == n) {
    if (l == 0) return 1;
    return 0;
  }
  int &ans = dp[i][l];
  if (ans != -1) return ans;
  ans = 0;
  for (int j = 0; j <= min(a[i], l); j++) {
    ans = (ans + solve(i + 1, l - j)) % md;
  }
  return ans;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof dp);
  cout << solve(0, k);
  return 0;
}
