#include <bits/stdc++.h>
using namespace std;
long int a[104], n;
long long int dp[104][100004];
void solve(long int in, long int num) {
  dp[in][num] = 0;
  if (in == n - 1 && num <= a[in]) {
    dp[in][num] = 1;
  }
  if (in == n - 1) return;
  long int i;
  for (i = 0; i < a[in] + 1; i++) {
    if (num - i < 0) break;
    if (dp[in + 1][num - i] == -1) solve(in + 1, num - i);
    dp[in][num] += dp[in + 1][num - i];
    dp[in][num] %= 1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    long int i, k;
    cin >> n >> k;
    for (i = 0; i < n; i++) cin >> a[i];
    memset(dp, -1, sizeof(dp));
    solve(0, k);
    cout << dp[0][k];
  }
  return 0;
}
