#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, k;
vector<int> vec;
int dp[100000 + 1][100];
int solve(int c, int i) {
  if (i == n - 1) {
    if (c > vec[i])
      return 0;
    else
      return 1;
  }
  if (c == 0) return 1;
  if (dp[c][i] != -1) return dp[c][i];
  int ans = 0;
  for (int j = 0; j <= vec[i]; j++) {
    if (c >= j) ans = (ans + solve(c - j, i + 1)) % mod;
  }
  return dp[c][i] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  vec.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  for (int i = 0; i <= 100000; i++) {
    for (int j = 0; j < 100; j++) {
      dp[i][j] = -1;
    }
  }
  cout << solve(k, 0);
  return 0;
}
