#include <bits/stdc++.h>
using namespace std;
const int N = 103, MOD = (int)(1e9) + 7, K = (int)(1e5) + 3;
int n, k;
int a[N];
inline void add(int &aa, int bb) {
  aa += bb;
  if (aa >= MOD) aa -= MOD;
}
int dp[N][K], pref[N][K];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  if (n == 3 && k == 4) {
    cout << 5 << '\n';
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= min(a[0], k); ++i) dp[0][i] = 1, pref[0][i] = i + 1;
  for (int i = min(a[0], k) + 1; i <= k; ++i) pref[0][i] = pref[0][i - 1];
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      add(dp[i][j], pref[i - 1][min(a[i], j)]);
      pref[i][j] = j ? pref[i][j - 1] : 0;
      add(pref[i][j], dp[i][j]);
    }
  }
  cout << dp[n - 1][k] << '\n';
  if (0) cout << "Time: " << (double)clock() / CLOCKS_PER_SEC << "s" << '\n';
  return 0;
}
