#include <bits/stdc++.h>
using namespace std;
const long long int md = 1e9 + 7;
const int N = 111;
const int K = 100011;
long long int n, k, cum[K][N];
vector<int> v;
int main() {
  cin >> n >> k;
  v.resize(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < N; i++) cum[0][i] = 1;
  for (int i = 1; i <= k; i++) {
    cum[i][n - 1] = v[n - 1] >= i;
    cum[i][n - 1] += cum[i - 1][n - 1];
  }
  long long int ans = cum[k][0];
  for (int i = n - 2; i >= 0; i--)
    for (int j = 1; j <= k; j++) {
      long long int val = v[i];
      long long int l, r;
      if (j > val)
        l = val, r = j - val;
      else
        l = j, r = 0;
      long long int all = cum[l + r][i + 1] % md;
      if (r) all = (all % md - cum[r - 1][i + 1] % md + md) % md;
      cum[j][i] = (cum[j - 1][i] % md + all % md) % md;
      ans = all;
    }
  cout << ans;
  return 0;
}
