#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
const int MOD = 1e9 + 7;
int m[MAX][101];
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  int a[n], sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < k) {
    cout << 0 << endl;
    return 0;
  }
  memset(m, 0, sizeof(m));
  m[a[n - 1]][n] = 1;
  int t;
  for (int c = n - 1; c >= 0; --c) {
    t = 0;
    for (int r = MAX - 1; r >= 0; --r) {
      t = (t + m[r][c + 1]) % MOD;
      if (r <= a[c]) {
        m[r][c] = t;
      }
    }
  }
  cout << m[0][0] << endl;
  return 0;
}
