#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  ll mod = 1e9 + 7;
  ll dp[110][100010] = {0};
  dp[0][k] = 1;
  for (int i = 0; i < (n); i++)
    for (int j = k; j >= 0; j--)
      for (int k = 0; k < (1 + a[i]); k++) {
        if (j < k) break;
        dp[i + 1][j - k] += dp[i][j];
        dp[i + 1][j - k] %= mod;
      }
  cout << dp[n][0] << endl;
  return 0;
}
