#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
long long n, k;
long long dp[110][110000];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin >> n >> k;
  vector<long long> a(n);
  long long asum = 0;
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a[i];
    asum += a[i];
  }
  if (asum < k) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = (long long)0; i < (long long)n; i++) {
    long long sum = 0;
    for (long long j = (long long)0; j < (long long)a[i] + 1; j++) {
      if (i == 0)
        dp[i][j] = 1;
      else {
        sum += dp[i - 1][j];
        dp[i][j] = sum;
        dp[i][j] %= (long long)(1e9 + 7);
      }
    }
  }
  cout << dp[n - 1][a[n - 1]] << endl;
}
