#include <bits/stdc++.h>
using namespace std;
long long int dp[101][100001];
long long int nn, a[101], k, mod = 1000000007;
void solve(long long int n, long long int m) {
  if (dp[n][m] != -1) {
    return;
  } else {
    dp[n][m] = 0;
  }
  if (n == nn - 1) {
    if (a[n] >= m) dp[n][m] = 1;
    return;
  }
  if (n >= nn) {
    return;
  }
  for (int i = 0; i <= a[n]; ++i) {
    if (m >= i) {
      solve(n + 1, m - i);
      dp[n][m] += dp[n + 1][m - i];
      dp[n][m] %= mod;
    } else {
      break;
    }
  }
  return;
}
int main() {
  cin >> nn >> k;
  for (int i = 0; i < 101; ++i) {
    for (int j = 0; j < 100001; ++j) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i < nn; ++i) {
    cin >> a[i];
  }
  solve(0, k);
  cout << "\n";
  cout << dp[0][k];
}
