#include <bits/stdc++.h>
using namespace std;
int niz[110];
int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<long long> dp(k + 2);
  for (int i = 1; i <= n; i++) cin >> niz[i];
  dp[0] = 1;
  for (int i = 1; i <= k; i++) dp[i] += dp[i - 1];
  for (int i = 1; i <= n; i++) {
    int l = niz[i] + 1;
    vector<long long> curr(k + 2, 0);
    curr[0] = 1;
    for (int j = 1; j <= k; j++) {
      curr[j] = curr[j - 1];
      curr[j] += dp[j];
      if (j >= l) curr[j] -= dp[j - l];
      curr[j] %= 1000000007;
      if (curr[j] < 0) curr[j] += 1000000007;
    }
    dp = curr;
  }
  if (k == 0)
    cout << 1 << endl;
  else
    cout << dp[k] - dp[k - 1] << endl;
}
